The height and width *in degrees* of a code depends only on the number of
digits, and it's constant.

A 10 digit code (like 8FW4V75V+8Q) is exactly 1/8000th of a degree high and
1/8000th of a degree wide. If you want to get say the neighbour to the
east, then you get the center latitude and longitude, add 1/8000 to the
longitude, and then encode that.

You could use this to get all 9 codes around the starting one. I put
together an example on jsfiddle
<https://jsfiddle.net/openlocationcode/L19g2690/> that you can play with.

It shouldn't be that hard ("an exercise for the reader") to change the
getNeighbours() function to also take the number of steps to the side that
you want to expand by.






Doug Rinckes, Technical Program Manager, Google Switzerland GmbH; 9GHJ+P88 Z
ürich <https://www.google.com/maps/search/9GHJ%2BP88%20Zürich>

On Tue, Jan 23, 2018 at 1:32 PM, Andreas B <andr...@bocops.de> wrote:

> Hi Tony,
>
> a simple way to achieve something like this would be to use prefixes and
> neighbors. For example, if the "exact" plus code of a location is
> *8FW4V75V+8Q*, then
> *8FW4V75V+*
> *8FW4V700+*
> *8FW40000+*
> *8F000000+*
> are near-rectangular surface area "tiles" that contain this location.
>
> This simple approach comes with a number of problems, for example the
> fixed size and shape, and also the fact that a location almost never is
> centered within its "tile". Adding neighbors at one tile size instead of
> changing to a bigger tile size can solve some of these problems, at the
> expense of some simplicity of the data structure.
>
> On Tuesday, January 23, 2018 at 12:30:56 PM UTC+1, Tony B wrote:
>>
>> Hi all
>>
>> Additional functionality that would be very useful in my view is the
>> creation of a buffer zone around a code or a collection of codes, according
>> to an inputted distance. This could be used for geofencing, for example.
>>
>> Tony
>>
>> On Friday, 17 November 2017 12:41:13 UTC+2, Andreas B wrote:
>>>
>>> A link from the wiki would be great, thanks for that!
>>>
>> --
> 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
> "open-location-code" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to open-location-code+unsubscr...@googlegroups.com.
> To post to this group, send email to open-location-code@googlegroups.com.
> Visit this group at https://groups.google.com/group/open-location-code.
> To view this discussion on the web, visit https://groups.google.com/d/
> msgid/open-location-code/684954e2-cb7d-4433-a5ee-
> 8855076d0838%40googlegroups.com
> <https://groups.google.com/d/msgid/open-location-code/684954e2-cb7d-4433-a5ee-8855076d0838%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 
"open-location-code" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-location-code+unsubscr...@googlegroups.com.
To post to this group, send an email to open-location-code@googlegroups.com.
Visit this group at https://groups.google.com/group/open-location-code.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/open-location-code/CAGFr2L%2B5WErZuhJaD9QNDvAb5zYU2onWtLufgHHYNqaud2B-0g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to