I want to know how to write code for polygon in OSM XML, I have tried to find it on internet but have not found something useful. SO Please let me know or give me some example of OSM XML Polygon Code.

asked 02 Apr '12, 20:12

Parveen%20Arora's gravatar image

Parveen Arora
16113
accept rate: 0%

edited 25 Jun '13, 00:58

aseerel4c26's gravatar image

aseerel4c26 ♦
31.9k16236548

2

What exactly are you trying to do? There are a lot of things you can do with polygons.

(02 Apr '12, 20:26) Gnonthgol ♦

I just need a little example of polygon code to view it.

(02 Apr '12, 20:39) Parveen Arora

Here's the simplest possible polygon, a triangle:

<way id="1" version="1" user="test" uid="1" changeset="1" timestamp="...">
  <nd ref="1" />
  <nd ref="2" />
  <nd ref="3" />
  <nd ref="1" />
  <tag k="building" v="yes" />
</way>

A polygon is just a way where first and last nodes are the same, and where the tags indicate that it is an area. (The same structure with a tag of junction=roundabout would not be interpreted as an area.)

More complex polygons - those with holes or where the outline is made up of several ways - are modeled using the multipolygon relations which is a bit of a misnomer since it is also used for polygons that are not "multi".

permanent link

answered 03 Apr '12, 00:41

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
68.1k806201061
accept rate: 24%

Usually you can click on any polygon in the map of www.openstreetmap.org while selecting the view data layer. From there it is possible to select a polygon and from the details page you can view the XML.

permanent link

answered 02 Apr '12, 21:19

frabron's gravatar image

frabron
3611411
accept rate: 16%

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:

×75
×69
×63

question asked: 02 Apr '12, 20:12

question was seen: 4,361 times

last updated: 25 Jun '13, 00:58

powered by OSQA