Hi, I think I am looking at a similar scenario and so, reviving this older thread. Excuse me if unrelated.
I have a bunch of plus codes (places within a city). I want to be able to find a subset of plus codes that fall within a radius of 'x' kms from another given plus code (current location of a user). Eg. get all bus stations within 5 kms of the current location of the user, where the plus codes of the bus stations are stored by my application. Conceptually I think I should be able to determine similarity between plus codes and perhaps compute distances from this subset to the current user location. Wanted the group's suggestion on how I may be able to accomplish this? Cheers, Sidd On Monday, 11 May 2015 18:17:35 UTC+5:30, Doug Rinckes wrote: > > This isn't something that I've done yet, but I'll describe the broad > approach that I've been thinking about. > > Let's say you have a database of codes, and a point, and you want > everything from your database that is "close" to that point. > > Basically, you're going to compute a list of OLC prefixes, and then select > all the entries in your database that start with the prefix. > > You can do it crudely - just pick a couple of areas that look promising > (for example this area <http://plus.codes/8FVC9GCV+> and this area > <http://plus.codes/8FVC9G9V+>, 8FVC9GCV+ and 8FVC9G9V+) and then take all > codes that start with either of those codes. For example, if I want > everything within about 100km of Zurich, and I'm not too fussy, I can just > use 8FVC as a prefix and get all my entries that start with that. > > If you care about the accuracy, you could draw a shape around the point of > interest, and then compute a list of all the OLC codes that fit within the > shape. Once you have the list of codes, you match the entries in your > database in the same way. > > This is possible because the code 8FVC9GCV+2J falls within 8FVC9GCV+, > which falls within 8FVC9G, which falls within 8FVC, which falls within 8F. > > This is appealing to me, because it means that instead of a complicated > calculation for every entry in the db, I have to do some moderately > complicated computations up front, and then it's just a string matching > routine for the db selection. > > If someone wants to do a library to compute coverings, it's probably worth > looking at the S2 library <https://code.google.com/p/s2-geometry-library/> > (also on github) for a similar kind of thing. > > > > > Doug Rinckes > Technical Program Manager > Google Switzerland > > On Sat, May 9, 2015 at 11:15 AM, <wilson.da...@gmail.com <javascript:>> > wrote: > >> Hi, >> >> I'm particularly interested in this benefit of your new codes format >> >> "Codes that are similar are located closer together than codes that are >> different" >> >> I have a database of existing locations for which i have lats and longs. >> what would be the best way to search for results in my data >> based on sub-codes ? >> >> >> -- >> 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 <javascript:>. >> To post to this group, send email to open-loca...@googlegroups.com >> <javascript:>. >> Visit this group at http://groups.google.com/group/open-location-code. >> To view this discussion on the web, visit >> https://groups.google.com/d/msgid/open-location-code/3881b1e3-db5e-48a9-a4da-c98df507ae36%40googlegroups.com >> >> <https://groups.google.com/d/msgid/open-location-code/3881b1e3-db5e-48a9-a4da-c98df507ae36%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 "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 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/37dc29dc-f973-46e8-a576-bd58fdd742d8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.