Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

NotificationsYou must be signed in to change notification settings

WebFreak001/DOpenLocationCode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Port of theopen-location-code library (also known asplus codes) for identifying geo areas.

This ports commita6eb95b.

Example

normal usage:

import openlocationcode;double lat =54;double lon =4;// get geo coordinates from plus code stringOpenLocationCode plusCode = OpenLocationCode.fromString("8FVC2222+22GCCCC");writeln(plusCode.decode());// -> OpenLocationCodeArea(47.0001, 8.00006, 47.0001, 8.00006, 15)// get plus code string from geo coordinatesOpenLocationCode generatedPlusCode = OpenLocationCode.encode(lat, lon);writeln(generatedPlusCode.code);// -> 9F662222+22

nothrow @nogc usage:

import openlocationcode;double lat =54;double lon =4;// get geo coordinates from plus code stringstring input ="8FVC2222+22GCCCC";// make sure to only use uppercase characters in your input!if (!input.isValidUppercaseCode)return error;OpenLocationCode plusCode = OpenLocationCode.fromTrustedString(input);if (!plusCode.isFull)return error;OpenLocationCodeArea area = plusCode.decodeTrustedFull();printf("area around %f, %f\n", area.centerLatitude, area.centerLongitude);// -> area around 47.000062, 8.000063// get plus code string from geo coordinatesubyte[maxOLCLength] buffer;scopeubyte[] generatedPlusCodeString = OpenLocationCode.encode(buffer, lat, lon);printf("%.*s\n", generatedPlusCodeString.length, &generatedPlusCodeString[0]);// -> 9F662222+22

About

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

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp