google / open-location-code

Open Location Code is a library to generate short codes, called "plus codes", that can be used as digital addresses where street addresses don't exist.
https://plus.codes
Apache License 2.0
4.07k stars 473 forks source link

Custom Codes #575

Closed codel00ps closed 4 months ago

codel00ps commented 5 months ago

Hello, I am new to this technology, and would like to know if I can create my own code structure and not use the existing ones that are found in the demo site

bocops commented 5 months ago

Depends on what you mean by custom code.

In practical terms, every point on earth's surface has its unique plus code, and you can get these codes from the plus.codes map, Google Maps, or by using the code in this reposiotory to generate plus codes from latitude/longitude coordinates.

If your question is about something along the lines of vanity phone numbers, then no. There's no way to, say, make "C0DEL00P+" point to the location of your business.

codel00ps commented 5 months ago

Thanks for the response.

No I meant something completely different, right now I can query coordinates and get the corresponding unique plus code. My question is if I can create / map these codes to a completely different set of codes that have a custom sequence of our desire.

Thanks

Regards, Codeloops Support Team On 17 Apr 2024 at 11:18 AM +0300, Andreas @.***>, wrote:

Depends on what you mean by custom code. In practical terms, every point on earth's surface has its unique plus code, and you can get these codes from the plus.codes map, Google Maps, or by using the code in this reposiotory to generate plus codes from latitude/longitude coordinates. If your question is about something along the lines of vanity phone numbers, then no. There's no way to, say, make "C0DEL00P+" point to the location of your business. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

bocops commented 5 months ago

Plus codes are basically just a different encoding of lat/long coordinate pairs.

You can of course map these codes to others, or just have a completely different encoding in the first place - but then the resulting codes would no longer be "plus codes" that can be parsed by the code in this repository, or any of the places that implement plus codes.

Is there a specific use case you have in mind?

codel00ps commented 5 months ago

I come from Lebanon, and we do not have zip codes in Lebanon. Delivery is very complicated here, you need to type in your full address and the streets are not numbered.

We are proposing a solution in which we use the concept of plus codes, the whole grid system on top of the country, but we need to generate readable meaningful codes instead depending on the districts. For example a location in Beirut the capitol city would look something like BRS495, which with time everyone would understand just by looking that this is a location in beirut, for example the seaside area.

I really thank you for following up on this, I am a developer, and trying to come up with a strategy, mainly I was thinking of creating the whole thing from scratch, but when I knew about plus codes, it is actually exactly what we wanted to build, only have control on the code structure and sequence, and the ability to change codes manually specifically for areas that are on the borders of other areas. I am not sure if I can achieve this by the help of the plus codes engine, and this is why I am asking you if this could be done or should I just build the whole thing separately.

Thanks a lot again.

Regards, Codeloops Support Team On 17 Apr 2024 at 12:09 PM +0300, Andreas @.***>, wrote:

Plus codes are basically just a different encoding of lat/long coordinate pairs. You can of course map these codes to others, or just have a completely different encoding in the first place - but then the resulting codes would no longer be "plus codes" that can be parsed by the code in this repository, or any of the places that implement plus codes. Is there a specific use case you have in mind? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

bocops commented 5 months ago

Ah, I see. Open Location Code includes the concept of short codes, which might be helpful in your case. It allows to drop a code prefix if you instead provide a reference location relative to which the short code will be interpreted. Let's look at an example:

  1. The full plus code of the National Museum in Beirut, Lebanon seems to be 8G5QVGH8+82.
  2. If you have a look at Google Maps, it provides the short code VGH8+82 Beirut, Lebanon instead for the museum. Four characters of the code have been replaced with the string "Beirut, Lebanon".
  3. If you search for the short code in Google Maps, what happens is that the code VGH8+82 is interpreted in the context of the coordinates returned by geocoding the string "Beirut, Lebanon".

The string used to identify the reference location can be anything you like, but you are responsible for the whole process of (reverse) geocoding. Considering that the whole of Lebanon is spread across just four different 4-letter prefixes (8G5Q, 8G5R, 8G6Q, 8G6R), you would even get away with something very simple like "SW", "SE", "NW", "NE", but using city names ("Beirut") or unique abbreviations based on city names (e.g. "BRT") would make the codes more easily understood.

If you pack your reference locations more densely, you might even achieve dropping two additional characters from the plus code. In that case, the code for the museum might become something like H8+82 BRT Central.

tigger6 commented 5 months ago

Could you please reach out to drinckes@google.com and sramek@google.com? There is a long context for plus codes adoption in Lebanon/LibanPost. Some of the things you're trying to do could even already exist.

codel00ps commented 5 months ago

Oh wow, will do so thank you so much.

Regards, Codeloops Support Team On Apr 17, 2024 at 3:48 PM +0300, tigger6 @.***>, wrote:

Could you please reach out to @. and @.? There is a long context for plus codes adoption in Lebanon/LibanPost. Some of the things you're trying to do could even already exist. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

drinckes commented 4 months ago

We're in discussion via email, I'll close this issue.