NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

4
1

I'm trying to use the boundary of London as a bounding polygon for an osmembrane pipeline. How do I convert http://www.openstreetmap.org/browse/relation/175342 into something more like http://wiki.openstreetmap.org/wiki/Osmosis/Polygon_Filter_File_Format so I can use it as the boundary polygon?

asked 24 Aug '12, 14:49

PeterGribble's gravatar image

PeterGribble
66237
accept rate: 0%


I don't know if there is an easier way, but that is how I was doing:

With JOSM

  1. File->Download an object, choose the type "relation" and give the id, uncheck "Download referents" and check "Download members"
  2. select all objects (Ctrl+A) and unselect the admin_centre (London in your example)
  3. copy the data (Ctr+C), create a new Layer (Ctrl+N) and paste your data (Ctrl+V)
  4. remove all the tags
  5. save the layer created in a .osm file (Ctrl+S)
  6. Use osm2poly.pl script for generate the poly file : perl osm2poly.pl data.osm > data.poly
permanent link

answered 24 Aug '12, 15:22

NicolasDumoulin's gravatar image

NicolasDumoulin
3.3k42256
accept rate: 13%

edited 04 Sep '12, 16:36

Pieren's gravatar image

Pieren
9.8k2083157

Thanks, that seems to have worked. It's cooking away now, so I'll have to see how it comes out!

(24 Aug '12, 16:33) PeterGribble

It seems to have come out in 60 different polygons, and when I ran my query it only found two results, whereas with a box covering the same rough area I got over 6000... Is that because the relation is made of 60 different ways? I've combined them in JOSM, and I'm about to try it again.

(28 Aug '12, 09:39) PeterGribble
1

I don't understand which query you're talking. Ensure that you're merging all the ways in JOSM, and remove all the tags. Then, you can check the resulting .poly file by opening it in a text editor. You should have only one polygon section in the file.

(28 Aug '12, 10:11) NicolasDumoulin
1

Have you seen the text at the top of osm2poly.pl? The bit about the "must have" tags is missing from Nicolas' description:

# script to convert an OSM file to a polygon file.
# the OSM file must follow certain conventions, namely
# each way must have a polygon_file and polygon_id tag,
# may have a note tag and must not have others.
(28 Aug '12, 10:19) cartinus

you're right cartinus, but I've never done that in my previous usage of this script … so I don't know, but you may try ;)

(28 Aug '12, 10:48) NicolasDumoulin
1

Yeah, it seems the original data were split into different ways, and combining them in JOSM before converting has fixed the problem. It's all working fine! Thanks Nicolas :)

(04 Sep '12, 14:41) PeterGribble

It seems that a JOSM plugin can be installed (name 'poly') and you can export the poly file directly from JOSM (http://josm.openstreetmap.de/wiki/Plugins)

(04 Sep '12, 16:40) Pieren
showing 5 of 7 show 2 more comments

You can use: http://polygons.openstreetmap.fr/

It will convert your relation ID to a poly file and it has an API :

http://polygons.openstreetmap.fr/get_poly.py?id=376823&params=0

permanent link

answered 06 Dec '18, 09:05

Potdeyaourt's gravatar image

Potdeyaourt
6123
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×252
×11
×9

question asked: 24 Aug '12, 14:49

question was seen: 7,007 times

last updated: 06 Dec '18, 09:05

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum