Reputation: 318
In one of my projects I have a issue to get the nearest street name and Point of Interest to some some coordinates. I am using OSM local database. I have imported some geo area to my MySQL database. To create it I followed this nice article http://goblor.de/wp/2009/10/16/openstreetmap-projekt-teil-1-openstreetmap-daten-in-mysql-datenbank-einlesen/ So I am using this structure http://goblor.de/wp/wp-content/uploads/2009/10/schema1.png
And now, I have a problem. I don't know how to retrieve data from it. I have some coordinates. My goal is to get the nearest road name and POI to it.
Does anyone have some ideas ?
Thanks
Upvotes: 1
Views: 1143
Reputation: 1435
It looks like that tutorial is only inserting the lat/lon coordinates. You will need to create geometry types and index them in order to query them spatially.
MySQL's spatial extensions are usually not the best solution for this sort of thing. I'd recommend using PostgreSQL if at all possible.
See this thread https://gis.stackexchange.com/questions/27878/how-to-find-20-closest-points-efficiently
and here for converting OSM: http://wiki.openstreetmap.org/wiki/Osm2pgsql
Upvotes: 1