Also, the original source I used that describes how to calculate plus codes 
now seems to be missing!

However, I've now just found another description of the algorithm and I'll 
now try to use it to complete my original MSAccess script.


[From: https://www.dcode.fr/open-location-code#q3 ]

How to convert GPS coordinates to Open Location codes?

>From GPS coordinates:

*Example:* (lat, long) = 48.8583,2.2923

1- add 90 <https://www.dcode.fr/big-numbers-addition>° to the latitude and 
180° to the longitude

*Example:*
 48.8583+90=138.858348.8583+90=138.8583, 2.2923+180=182.29232.2923+180=182.2923

2- multiply <https://www.dcode.fr/big-numbers-multiplication> the values by 
8000 (= 20 ^ 3)

*Example:*
 138.8583×8000=1110866.4138.8583×8000=1110866.4, 
182.2923×8000=1458338.4182.2923×8000=1458338.4

3- convert the values obtained to base 20 (with the 
alphabet 23456789CFGHJMPQRVWX) by limiting yourself to the whole part and 
supplementing with initial zeros if the result has less than 5 digits.

*Example:*
 
1110866(10)=[6,18,17,3,6](20)=8WV58(20OLC)1110866(10)=[6,18,17,3,6](20)=8WV58(20OLC),
 
1458338(10)=[9,2,5,16,18](20)=F47RW(20OLC)1458338(10)=[9,2,5,16,18](20)=F47RW(20OLC)

4- insert the 2 times52 times5 characters obtained by alternating latitude 
then longitude and write the result in the form 'XXXXXXXX + XX'

*Example:* 8WV58 and F47RW give 8F,W4,V7,5R,8W or the *plus code*
 8FW4V75R+8W

How to recognize a Open Location codes?

The *Open Location* (OLC) codes are in the format XXXXXXXX+XX or 
sometimes XXXX+XX Place (the first 4 characters are deleted) this second 
form requires a database in order to know the place which allows to find 
the 4 first characters.

Codes have a + hence their nickname *plus codes*

The Google company created these codes which are used more and more, thanks 
to Google Maps, any reference to the search engine is a clue.

On Wednesday, October 14, 2020 at 3:05:37 PM UTC+1 theriverm...@gmail.com 
wrote:

> LOL, I have no idea how/why my script works so quickly!
>
> Yes, there are APIs available. However, as you already have the data 
> neat-n-tidy in a table, it might be easier to use the database to do the 
> algorithm.
> An API such as:  
> https://github.com/google/open-location-code/wiki/Plus-codes-API  returns 
> a rather long JSON email for each lon/lat which would then need further 
> scripting to retrieve the pluscode. 
>
> Yes, it is unfortunate that your tables are dbf. However, if you do have 
> MSAccess, it can import and/or link to dbf files. From there, my example 
> script could be used.
>
> Does your table's location data change much/frequently or is it 
> referencial/historic?
>
> Depending on your circumstances, I'd happily add a pluscode field to your 
> table for you. For privacy issues, you may want to edit the table to only 
> include the lon/lat and the index/primary key.
>
> Bare in mind, though, that my script presently is accurate to the "+" part 
> of the pluscode - which gives a global reference to a square measuring  275 
> metres on the side 
>
> On Wednesday, October 14, 2020 at 2:32:13 PM UTC+1 anthony...@gmail.com 
> wrote:
>
>> Unfortunately, I'm working with dbf tables. I was hoping that there was a 
>> separate API call that would allow me to send batches of requests.  How in 
>> the world are you getting your script to run so quickly? 
>> Thanks
>>
>> On Tuesday, October 13, 2020 at 2:05:48 PM UTC-4 theriverm...@gmail.com 
>> wrote:
>>
>>>
>>> Hi,
>>>
>>> Perhaps if it is an MSAccess database, you could try my VBA script from 
>>> here:
>>> https://github.com/google/open-location-code/issues/364 
>>>
>>> Given a table that includes lon lat fields, it will generate an 
>>> additional field containing pluscodes to the accuracy of the "+"
>>> My issue on GitHub was asking for clarification on calculating the 
>>> pluscode to the right of the "+"
>>>
>>> My script can work on tables of about 50k records, however, I found 
>>> that, for some reason, the script works better on larger tables when they 
>>> are stored as separate CSV files. 
>>> On Tuesday, October 13, 2020 at 6:50:03 PM UTC+1 anthony...@gmail.com 
>>> wrote:
>>>
>>>> Is there a method that would allow for batch requests? I'd like to 
>>>> request a code for each address in my database (around 33k), is the only 
>>>> way to do this is one at a time?
>>>>
>>>> Thanks,
>>>
>>>

-- 
Public site: http://www.openlocationcode.com/
Github project: https://github.com/google/open-location-code
Demo site: http://plus.codes/
--- 
You received this message because you are subscribed to the Google Groups "Plus 
Codes Community Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-location-code+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/open-location-code/a277ed37-e814-4f53-854c-1f3a9994ff4fn%40googlegroups.com.

Reply via email to