Re: [OSM-dev] Polygon buffer tool (for Osmosis)
Hi Marcus, Quoting marcus.wolsc...@googlemail.com: > Excuse me, wich polygon is buffered, when and for what purpose? Sorry for being a bit unclear. Richard already explained it, so no need for me to touch that again. > Why does it need a PostGIS for this job? Wouldn't calculating > the normal in each vertex and offsetting the vertex along that normal > be enough? (Plus a check if the new location is not inside the polygon, > else offset only to the point where it touches the polygon.) I started using PostGIS, because that is what I'm familiar with. Frederik Ramm suggested to directly use GEOS instead, so that is what I'm going to do next. Shapely might also be an option, but I'm not sure if it has implemented polygon buffering. Implementing a buffering algorithm myself is a waste of time when other alternatives are available. One other note. I'm not sure if you noticed it, but the buffering takes place in WGS84. So the closer the geometry is to a pole, the bigger the distortion is of buffering in the horizontal direction, as compared to the vertical direction. For me that was an acceptable trade-off. I already mentioned in the script that accepting a SRS parameter might be a welcome future extension. Regards, Frank ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] Polygon buffer tool (for Osmosis)
Quoting Marcus Wolschon : > It's a python-script. How would you like > to do that "inside osmosis"? > Hi Marcus, What Emilie probably meant was that it would be a good idea to accept the buffering distance as an argument in Osmosis, so that Osmosis would apply the buffering before using the polygon to extract features. It would be necessary to do this by JTS or by another geometry library which can do the buffering. Since I'm not a Java programmer, I haven't done that, but otherwise I might have given that a try. Frank ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] Polygon buffer tool (for Osmosis)
It's a python-script. How would you like to do that "inside osmosis"? ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] Polygon buffer tool (for Osmosis)
2009/12/11 Frank Steggink > Hi, > > I've created a small Python tool which buffers the polygon in a polygon > file (for Osmosis), and creates a new polygon file. It can be found > here: [1]. For the buffering PostGIS is used. All Canadian polygon files > from [2] have been tested and are working. > > Requirements: Python (2.6, but 2.5 likely works too), PostGIS (1.3+), > PyGreSQL > More info can be found in the file itself, or by typing "./polybuffer.py > -h" in the command prompt. > > Please let me know any issues you experience with this tool. > If it is for Osmosis, do you think it would be a good idea to add a dependency to JTS inside Osmosis to do it directly inside Osmosis? Emilie Laffray ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] Polygon buffer tool (for Osmosis)
On Fri, Dec 11, 2009 at 7:03 AM, wrote: > On Thu, 10 Dec 2009 21:40:39 -0500, Frank Steggink > wrote: >> Hi, >> >> I've created a small Python tool which buffers the polygon in a polygon >> file (for Osmosis), > > Excuse me, wich polygon is buffered, when and for what purpose? [ ... ] > I guess these created polygon-files are nice for extracts that shall > contain elements next to the border? Yes. Sometimes the surrounding area is interesting for context. Here is an example of osmosis making several extracts with polygons. http://wiki.openstreetmap.org/wiki/Osmosis/Examples http://svn.openstreetmap.org/applications/utils/osm-extract/polygons/polybuffer.py http://www.maproom.psu.edu/dcw/ ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] Polygon buffer tool (for Osmosis)
On Thu, 10 Dec 2009 21:40:39 -0500, Frank Steggink wrote: > Hi, > > I've created a small Python tool which buffers the polygon in a polygon > file (for Osmosis), Excuse me, wich polygon is buffered, when and for what purpose? >From the source I see "Calculate a buffer around the polygon, using PostGIS". So this creates some PostGIS geometry that covers whatever the polygon covers "NB: holes aren't supported yet" plus some area around the polygon? Then this (temporary?) geometry is exported as another polygon-file? If is is a python-scrips, how is it used with Osmosis? I guess these created polygon-files are nice for extracts that shall contain elements next to the border? Why does it need a PostGIS for this job? Wouldn't calculating the normal in each vertex and offsetting the vertex along that normal be enough? (Plus a check if the new location is not inside the polygon, else offset only to the point where it touches the polygon.) > and creates a new polygon file. It can be found > here: [1]. For the buffering PostGIS is used. All Canadian polygon files > from [2] have been tested and are working. > > Requirements: Python (2.6, but 2.5 likely works too), PostGIS (1.3+), > PyGreSQL > More info can be found in the file itself, or by typing "./polybuffer.py > -h" in the command prompt. > > Please let me know any issues you experience with this tool. > > Cheers, > > Frank > > [1] > http://svn.openstreetmap.org/applications/utils/osm-extract/polygons/polybuffer.py > [2] http://www.maproom.psu.edu/dcw/ Regards, Marcus ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
[OSM-dev] Polygon buffer tool (for Osmosis)
Hi, I've created a small Python tool which buffers the polygon in a polygon file (for Osmosis), and creates a new polygon file. It can be found here: [1]. For the buffering PostGIS is used. All Canadian polygon files from [2] have been tested and are working. Requirements: Python (2.6, but 2.5 likely works too), PostGIS (1.3+), PyGreSQL More info can be found in the file itself, or by typing "./polybuffer.py -h" in the command prompt. Please let me know any issues you experience with this tool. Cheers, Frank [1] http://svn.openstreetmap.org/applications/utils/osm-extract/polygons/polybuffer.py [2] http://www.maproom.psu.edu/dcw/ ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev