[OSM-dev] tools to add buffer to poly
Sebastian Kürten
sebastian.kuerten at fu-berlin.de
Tue Nov 27 12:03:28 UTC 2018
Hi Florian,
I've been doing this quite frequently for my own projects and have
made the relevant tools available as open source a while ago.
You can find CLI tools in this project:
https://github.com/topobyte/simple-mapfile
I haven't written proper documentation yet, but here is how to create a
buffered polygon from an initial file polygon.wkb and store the
results in a file called buffered.wkb (on Linux):
./scripts/SmxCreate --geometry polygon.wkb
--output polygon.smx
./scripts/SmxBuffer --input polygon.smx
--distance 0.01
--output buffered.smx
./scripts/SmxExportGeometry --input buffered.smx
--output buffered.wkb
Make sure to run './gradlew create' before trying to run the scripts.
The input needs to be a plain WKB or WKT file, such as this:
https://github.com/ThatsBerlin/admin-areas/blob/master/bundesland/Berlin.wkb
The process involves creating an intermediary 'smx' file, which is
basically an XML file format that stores a WKB geometry base64-encoded
plus tags like we do in OSM. The buffer operation is available for smx
files and to get back to WKB or WKT you use the reverse operation.
I also have an implementation for reading poly files, but have not
integrated it into the toolchain at this point. I think there are tools
for converting from poly to wkt. I can also reintegrate the poly
import/export functionality if you are interested in using this
solution.
The distance argument is not meters or anything, but degrees which is
not very useful if you need exact bufferes in meters but for my use
cases it always worked to find a proper degree value and just use that
for my buffer polygons.
Best,
Sebastian
On Tue, 27 Nov 2018 10:10:35 +0100
Florian Lohoff <f at zz.de> wrote:
> Hi,
> i am using poly exports from Wambacher (thanks) to extract pbf
> content from a germany export. Now i am trying to use the
> admin boundarys from the pbfs which obviously get dropped
> when using itself as boundary.
>
> I'd rather not like to buffer them manually by drawing boundarys
> myself.
>
> So - is there a tool(-chain) for poly -> poly adding some buffer
> e.g. 50-100m ?
>
> Flo
More information about the dev
mailing list