d-open-location-code 1.0.0

port of google's open-location-code (also known as Plus+Codes)


To use this package, run the following command in your project's root directory:

DOpenLocationCode

Port of the open-location-code library (also known as plus codes) for identifying geo areas.

This ports commit a6eb95b.

Example

normal usage:

import openlocationcode;

// get geo coordinates from plus code string
OpenLocationCode plusCode = OpenLocationCode.fromString("8FVC2222+22GCCCC");
writeln(plusCode.decode());
// -> 

// get plus code string from geo coordinates
OpenLocationCode generatedPlusCode = OpenLocationCode.encode(lat, lon);
writeln(generatedPlusCode.code);

nothrow @nogc usage:

import openlocationcode;

// get geo coordinates from plus code string
string input = "8FVC2222+22GCCCC";
if (!input.isValidCode)
	return error;
OpenLocationCode plusCode = OpenLocationCode.fromTrustedString(input);

if (!plusCode.isFull)
	return error;
OpenLocationCodeArea area = plusCode.decodeTrustedFull();
printf("area around %d, %d", area.centerLatitude, area.centerLongitude);

// get plus code string from geo coordinates
ubyte[maxOLCLength] buffer;
scope ubyte[] generatedPlusCodeString = OpenLocationCode.encode(buffer, lat, lon);
printf("%s", cast(char[])generatedPlusCodeString);

Dependencies:
none
Versions:
1.0.1 2020-Jan-08
1.0.0 2020-Jan-08
~master 2020-Jan-08
Show all 3 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 0 downloads total

Score:
0.5
Short URL:
d-open-location-code.dub.pm