A PowerShell module for working with Open Location Code (Plus Codes) using the Google.OpenLocationCode library.
- Convert latitude/longitude to Open Location Code (OLC)
- Convert OLC back to latitude/longitude area
- Support for short codes with reference location
- Customizable code length
Converts latitude and longitude to an Open Location Code.
Parameters:
Latitude(double, mandatory): Latitude to convertLongitude(double, mandatory): Longitude to convertLength(int, optional): Length of the code (default: 10)ReferenceLatitude(double, mandatory for short code): Reference latitudeReferenceLongitude(double, mandatory for short code): Reference longitudeShort(switch, optional): Generate a short code
Examples:
ConvertTo-OLC -Latitude 37.421908 -Longitude -122.084681
ConvertTo-OLC -Latitude 37.421908 -Longitude -122.084681 -Short -ReferenceLatitude 37.4 -ReferenceLongitude -122.08Converts an Open Location Code back to a geographic area.
Parameters:
Code(string, mandatory): OLC code to convertReferenceLatitude(double, mandatory for short code): Reference latitudeReferenceLongitude(double, mandatory for short code): Reference longitudeShort(switch, optional): Indicates the code is a short code
Examples:
ConvertFrom-OLC -Code "849VCWC8+R9"
ConvertFrom-OLC -Code "CWC8+R9" -Short -ReferenceLatitude 37.4 -ReferenceLongitude -122.08- Build the project using .NET (see
.csprojfor details) - Import the module in PowerShell:
Import-Module ./PSOpenLocationCode/bin/Debug/net9.0/PSOpenLocationCode.dll
See the Documents/ folder for detailed cmdlet usage and examples.
This project is licensed under the MIT License.
It also incorporates the Google.OpenLocationCode library, which is licensed under the Apache 2.0 License.
For more information about Open Location Code, visit https://plus.codes/