[wp-hackers] Geodata storage
Dylan Kuhn
dylan.k.kuhn at gmail.com
Tue Jul 13 23:39:51 UTC 2010
On Wed, Jun 9, 2010 at 7:35 AM, Dougal Campbell <dougal at gunters.org> wrote:
> If you're searching for posts based on location, you'll want them
>> separate so as to make use of SQL comparisons. WHERE latitude is
>> between X and Y, sort of thing.
>>
>>
>>
>
> Good point, I didn't think about using BETWEEN to limit the searches. That
> would be a quick way to find matches within a rectangular area. And like I
> said, if you combine them, you'd still have to decouple them for usage
> later. So nevermind on that :)
>
>
Sorry I'm so late to this thread. My plugin Geo Mashup [1] does just the
kind of stuff being discussed here. It grew out of the old Geo plugin [2]
which stored coordinates as latitude / longitude pair in postmeta with key
_geo_location. I moved away from this because it was difficult to do spatial
queries, which started with bounding box queries along the lines of this
sort of BETWEEN query, and grew to include radius queries. Text searching
with results sorted by distance is a popular feature request I'm still
working on.
I didn't do rigorous testing, but performance seemed better to me with a
table of indexed latitude and longitude, so I went that way. I also
considered MySQL spatial extensions, but I wanted to be able to use standard
SQL queries. For the radius query I was also influenced by a paper that
still seems to be prevalent [3] that addresses some performance issues and
compares various methods. It seems like it would be difficult to implement
with postmeta, but if it were shown to work well I would definitely consider
moving back that way. If not, I'll probably have to do some kind of
synchronization with the standard fields.
[1] http://wordpress.org/extend/plugins/geo-mashup/
[2] http://wordpress.org/extend/plugins/geo/
[3] http://www.scribd.com/doc/2569355/Geo-Distance-Search-with-MySQL
-dylan-
More information about the wp-hackers
mailing list