[OSM-dev] Extracting polygons from planet.osm - take 2
Frederik Ramm
frederik at remote.org
Thu Mar 15 21:39:27 GMT 2007
Hi Keith,
> - Takes input from a text file defining a polygon or polygons as a
> sequence of longitudes and latitudes.
It would be great if there was some sort of mechanism by which a polygon
could be loaded from an external data source. However geonames only has
bounding boxes, not exact border polygons, and the web site I used for
my original script didn't lend itself well to automation (getting the
file was a multi-step process). So that you could specify
"--country-borders=ie" and get Ireland, or whatever.
> - Can optionally reduce the number of points in a polygon to improve
> performance, at the expense of accuracy.
The formula I have used in my script, and which you have copied, is
quite crude. What I did is reduce a polygon of "n" points to
(n+2*sqrt(n))/3 points, and furthermore drop all polygons which didn't
exceed a certain size (to get rid of uninhabited micro-islands which
were included in my source set of polygons).
It is probably not a good idea to use this simplification as-is. Maybe
you should offer a flag "-c<number>" where number is a "point reduction
percentage" and then do $pol->simplify($pol->nrPoints*(100-$number)/100)
- that way the user could specifiy the degree of simplification
required. And perhaps make sure that only polygons in excess of 100
points or so are ever simplified.
> I would appreciate it if people could try this out and let me know if it
> works, and is accurate! If people think this is valuable I would like
> to create directory in SVN for both the script and a collection of
> polygon files, I am happy to oversee this. I would also like to create
> a Wiki page describing the script usage and polygon files.
+1 from me.
Bye
Frederik
--
Frederik Ramm ## eMail frederik at remote.org ## N49°00.09' E008°23.33'
More information about the dev
mailing list