Powershell Module for Google Map


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 LocationLocal 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

1

FUNCTIONALITIES :

This module brings following Functionalities of Google Maps to your Powershell console –

  1. 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 

    Geocode

  2. REVERSE GEOCODING :

    Reverse geocoding is the process of converting geographic coordinates into a Human-Readable addresses.

    ReverseGEo
  3. 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.

    whereami
  4. 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.

    gtz

  5. 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

    searchnearby

  6. DIRECTION :

    Powershell Function utilizes Google Maps Directions API to calculate directions between locations making an HTTP request call to the API.

    direction

  7.  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.

    distance

 

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 😛

env

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.

psgallery

Below are the steps how to download and install the module on your machine.

Install-module

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.

help

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

15 thoughts on “Powershell Module for Google Map

  1. 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?

    Like

  2. Hello,

    The Module is awesome ! No need to code something that already done.
    If I may, the get-distance should return the {Distance,Time} field value in addition to the text. It could be better to use the time in seconds than the text when you want to work with it in a script. No need to show it in the result.

    Like

  3. Hey wow great job 🙂
    Is there any way that you implement a feature to grab the saved location lists from Google Maps?
    Thanks Wolfgang

    Like

  4. So i created a google key. Imported the modules etc. Everything works fine until i try to run one of the geo location cmdlets. I tried setting my API key using

    Like

    1. Sorry, i’m setting my api key using $env:GooglePlaces_API_KEY=”xxxxxxxxxxxxxxxx” . bUT WHEN I RUN Get=GeoLocation it says that i need to register. What am I doing wrong?

      Like

Leave a comment