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


I'm trying to use the boundary of London as a bounding polygon for an osmembrane pipeline. How do I convert into something more like so I can use it as the boundary polygon?

asked 24 Aug '12, 14:49

PeterGribble's gravatar image

accept rate: 0%

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


  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 script for generate the poly file : perl data.osm > data.poly
permanent link

answered 24 Aug '12, 15:22

NicolasDumoulin's gravatar image

accept rate: 13%

edited 04 Sep '12, 16:36

Pieren's gravatar image


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

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

Have you seen the text at the top of 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

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 (

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

You can use:

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

permanent link

answered 06 Dec '18, 09:05

Potdeyaourt's gravatar image

accept rate: 0%

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 24 Aug '12, 14:49

question was seen: 7,171 times

last updated: 06 Dec '18, 09:05

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