pois and wrong citynames

Hi, In all pois that can contain extra info fields for address information, a default city is automatically created by mkgmap (if it isn't already there in osm). Sometimes those place names contains the wrong cityname, so I wonder if there is a way to lookup a more correct cityname from the polygons style file, before this mkgmap process kicks in. For instance, I would like to add a statement in the points style file like addr:city which looksup the correct city name from the polygons style file, if a poi that lies within a polygon with the tags place=city/town/village (or boundary=city/..) or even landuse=residential (with a name). Or maybe even from multipolygons created from administrative boundaries (like municipalities)? For my custom map, I created transparent polygons for those areas, and in Mapsource the name of place=city etc shows up if I point with the mouse to a certain area within the polygon. So I wonder if it is possible to combine those names with the pois. Any ideas? Cheers, Minko

On Fri, May 7, 2010 at 11:55 AM, Minko <ligfietser@online.nl> wrote:
For instance, I would like to add a statement in the points style file like addr:city which looksup the correct city name from the polygons style file, if a poi that lies within a polygon with the tags place=city/town/village (or boundary=city/..) or even landuse=residential (with a name). Or maybe even from multipolygons created from administrative boundaries (like municipalities)?
I can't add too much here, but I think it is worth mentioning that, as I understand it, the algorithm for determining if a point lies within a polygon can be quite performance intensive: http://en.wikipedia.org/wiki/Point_in_polygon There are of course libraries for dealing with this problem, but I still think the performance question is still significant. Cheers.

On Fri, May 7, 2010 at 11:55 AM, Minko <ligfietser@online.nl> wrote:
I can't add too much here, but I think it is worth mentioning that, as I understand it, the algorithm for determining if a point lies within a polygon can be quite performance intensive:
http://en.wikipedia.org/wiki/Point_in_polygon
There are of course libraries for dealing with this problem, but I still think the performance question is still significant.
Performance shouldn't be a problem, since there's no need to perform a full polygon intersection test for each point and each city boundary. If a pre-processing stage builds up a data structure (eg a quadtree, where each node has at most a single polygon edge segment running through it), the lookups become pretty cheap (O(log n)). Other options include narrowing down the tests using bounding rectangles around each polygons with perhaps an r-tree (assuming some bounding rectangles overlap?) to rapidly determine which bounding rectangle to test further. Of course implementing the above is a fair amount of work, however it'll be much much faster than the brute force approach. If anyone is interested in actually implementing this, feel free to ping me for further ideas or details.
participants (3)
-
Chris Miller
-
Clinton Gladstone
-
Minko