Select to view content in your preferred language

got Open Location Code technology / Plus Codes?

3820
10
08-08-2017 12:56 PM
BrianQuinn
Occasional Contributor

Has anyone else looked for an implementation of Open Location Code technology in ArcGIS Pro?

I would like to create Plus Codes for all our city buildings, and I'll be able to do it with a Google API, or with code from GitHub - google/open-location-code: Open Location Code is a library to generate short codes that can...   but hey, anyone doing this within GIS?  (partial credit for success via QGIS  ;^)

-=Brian Q

at  849VQHGJ+2M9 

10 Replies
emmornile1
Frequent Contributor

Any progress Brian?

It seems that the Plus Code system might have some merit, but the description is very non-GIS.

Emmor

84PRWXJR+2Q

0 Kudos
BrianQuinn
Occasional Contributor

Hi Emmor,

I note that Daniel Diaz has generated them for all building footprints in Puerto Rico.

Also, the GitHub site appears to support seven languages' worth of implementations.

Seems like ArcGIS is just not central to OLC quite yet.

Diaz map

https://www.arcgis.com/home/item.html?id=42575cc228f149feab7d9fe55b742f41  

GitHub site

GitHub - google/open-location-code: Open Location Code is a library to generate short codes that can...  

-=Brian Q

emmornile1
Frequent Contributor

Brian,

I was able to use the OLC Python code directly in Pro to calculate the 10 digit plus code for some building points in Africa.  It took a little over an hour to do 18 million points.  After that is was easy to pull out the local 6 digit + code and to an overlay with regions to get an address combination.  I notice that OSMAnd now supports plus codes.

Emmor

0 Kudos
BrianQuinn
Occasional Contributor

That sounds like it’s ready for production. Thanks for the update!

-=Brian Q

MalcolmMeyer2
Frequent Contributor

Any work on this or anyone want to post detail on how to use the python code in PRO to generate pluscodes. QGIS now has a plugin that will do this but native support in ArcGIS Pro would be great.

0 Kudos
emmornile1
Frequent Contributor

Malcolm, I have calculated Plus code values in Pro several times. In the table calculate dialog paste the script text posted on Github and run, it's fairly painless. 

0 Kudos
JakeKrall
Frequent Contributor

Emmor,

Can you be more specific on how you did the calculate, please?  Did you use the "def encode..." part of the python code like the following:

def encode(latitude, longitude, codeLength=PAIR_CODE_LENGTH_):
 if codeLength < 2 or (codeLength < PAIR_CODE_LENGTH_ and codeLength % 2 == 1):
 raise ValueError('Invalid Open Location Code length - ' + str(codeLength))
 # Ensure that latitude and longitude are valid.
 latitude = clipLatitude(latitude)
 longitude = normalizeLongitude(longitude)
 # Latitude 90 needs to be adjusted to be just less, so the returned code
 # can also be decoded.
 if latitude == 90:
 latitude = latitude - computeLatitudePrecision(codeLength)
 code = encodePairs(latitude, longitude, min(codeLength, PAIR_CODE_LENGTH_))
 # If the requested length indicates we want grid refined codes.
 if codeLength > PAIR_CODE_LENGTH_:
 code = code + encodeGrid(latitude, longitude, codeLength - PAIR_CODE_LENGTH_)
 return code

in the Code Block?  And what did you put in the <fieldname> = box?

0 Kudos
emmornile1
Frequent Contributor

Jake

The code I used is: #   encode(!POINT_Y!,!POINT_X!,10)

I just pasted the whole openlocationcode.py into the calculate dialog in PRO.

Cheers

Emmor

0 Kudos
FabienAncelinNCR
New Contributor

Hi Brian,

We've worked with Plus Codes / Open Location codes for some of our clients, and along with a workmate, we've created an open source geoprocessing tool to work with Plus Code in ArcGIS Pro. The tool is open source, and an help and tutorial about Plus Code and ArcGIS can be found on the tool's repo: https://github.com/fabanc/arcgis-plus-code-generator. I hope that helps.

0 Kudos