Hey Everyone!
Sometime back I wrote a blog post on how to get Google map Directions and Distance in your PowerShell console using Google API’s.
Today I’ve few more interesting functions to calculate Your Current Location, Local time of place, Time zone, searching Nearby places , getting Geographical Coordinates a location and reverse and some more wrapped up in a PowerShell module named “GoogleMap”
FUNCTIONALITIES :
This module brings following Functionalities of Google Maps to your Powershell console –
-
GEOCODING :
Geocoding is the process of converting addresses (like a street address) into geographic coordinates (like latitude and longitude) and other information like Postal Code, State, Country
-
REVERSE GEOCODING :
Reverse geocoding is the process of converting geographic coordinates into a Human-Readable addresses.
-
GEO LOCATION ( Current Geographical Location in address) :
The function captures Information of nearby WiFi nodes and send it to Google Maps Geolocation API to return location and Geographical coordinates.
Incase there are no Wireless access point (WiFi) available, API won’t be able to return the location information.
Communication is done over HTTPS using POST. Both request and response are formatted as JSON, and the content type of both is application/json.
-
TIMEZONE ( and Local Time ) :
Time Zone API provides time offset data for any location on earth. You request the time zone information for a specific latitude/longitude pair and date and API returns the name of that Time Zone, Time Zone ID and Local time for the coordinates.
-
SEARCH NEARBY PLACE :
This Powershell function employs Google Places API to query nearby places on a variety of categories, such as: establishments, prominent points of interest, geographic locations, and more for a coordinate.
Information like – Name , Address and Open status for stores and restaurants are returned
-
DIRECTION :
Powershell Function utilizes Google Maps Directions API to calculate directions between locations making an HTTP request call to the API.
-
DISTANCE :
The Google Maps Distance Matrix API is a service that provides Travel Distance and Time for a matrix of origins and destinations, based on the recommended route between start and end points.
PREREQUISITES :
You need to do one-time registration for each Google map API, before start using the module, because it won’t work without an API Key.
I would suggest to store the API Keys into your Powershell $Profile so that it automatically loads everytime the console is fired.
Below are the links to register API keys and a screenshot on – how to keep the API keys in your $Profile to make your life a bit easy 😛
LINK TO REGISTER API KEYS –
Get-Direction – https://developers.google.com/maps/documentation/directions/get-api-key
Get-Distance – https://developers.google.com/maps/documentation/distance-matrix/get-api-key
Get-GeoCoding – https://developers.google.com/maps/documentation/geocoding/get-api-key
Get-GeoLocation – https://developers.google.com/maps/documentation/geolocation/get-api-key
Get-NearbyPlace – https://developers.google.com/places/web-service/get-api-key
Get-ReverseGeoCoding – https://developers.google.com/maps/documentation/geocoding/get-api-key
Get-TimeZone – https://developers.google.com/maps/documentation/timezone/get-api-key
INSTALLATION :
You can directly Install-Module from the PowerShell Gallery if you’ve the PowershellGet module, like in the below screenshot.
Below are the steps how to download and install the module on your machine.
MODULE HELP :
Google map module includes Help information for all the cmdlets, you can Get-Help to understand how the each cmdlets work, with examples.
GET THE SCRIPT :
Click here to follow my GitHub Repository for Google Map to get the script and other files.
If you find it intresting, you can contribute on my GitHub Repo and assist me make it better. Happy Learning ! 🙂
Prateek Singh
Related posts
0 Comments
Leave a Reply to Prateek SinghCancel reply
Categories
Author of Books
Awards
Open Sourced Projects
Author at
Blog Roll
Mike F RobbinsDamien Van Robaeys
Stéphane van Gulick
Kevin Marquette
Adam Bertram
Stephanos Constantinou
Francois-Xavier Cat
Ravikanth Chaganti
Roman Levchenko
Blog Stats
- 1,133,185 People Reached
[…] This is a quick blog post and a continuation to my previous blog post on Powershell Module for Google map […]
I really like your articles around powershell, The company i work with is pushing powershell based automation in a big way
Thanks for finding some time to read and appreciate my work! 🙂 Yes , Powershell makes automation look like cake-walk, hence organizations are inclined towards it.
I’ve tried the scripts of GeoLocation. However, the wifi cannot be found. Just get confused with it as my wifi is on.
These cmdlets are so good! Thanks for sharing them. 🙂
You’re welcome 🙂
This looks really awesome. However when attempting to install. Receive the following:
A command with name ‘Get-TimeZone’ is already available on this system. This module ‘GoogleMap’ may override the existing commands. If you still want to install this module ‘GoogleMap’, use -AllowClobber parameter. Looks like the Get-TimeZone conflicts with System.TimeZoneInfo.
Thoughts?
Ditto.
What’s the solution to this conflict? I’m new to Powershell and haven’t been able to figure out a workaround.
Any powershell routine to encode/decode a polyline? My binary math skills suck.
[…] This is a quick blog post and a continuation to my previous blog post on Powershell Module for Google map […]