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 ! 🙂

@SinghPrateik