Уважаемые коллеги!

Я хочу сделать парсер и получить из OSM-файла связанную информацию типа Область/Район/Населенный пункт/Улица/Дом. Можно ли считать, что если начать с корневого relation страны, то спускаясь вниз по вложенным relation и далее по их way и node, я смогу получить всю информацию? Просто эксперименты показали, что в OSM-файле имеются "висящие" way и node. Т.е. например node входит в состав way, а way никуда не входит. Попытки в таком случае определить принадлежность по координатам (вхождение внутрь полигона) тоже не всегда дает результат, т.к. многие населенные пункты (в основном деревни) вообще не имеют границ (way с ролью border). Хочется знать, на какие вещи можно 100% полагаться.

Спасибо.

[ English translation via Google Translate ]

I want to make the parser and get the file from the OSM-related information such as State / District / Town / Street / House. Can I assume that if we start from the root relation of the country, descended down the nested relation and continue on their way and node, I can get all the information? Simple experiments showed that the OSM-file are "hanging" way and the node. Ie such node is part of the way, a way will not enter. Attempts in this case to determine the membership of the coordinates (entering into the landfill) do not always produce the result, because many communities (mostly villages) have no boundaries (way the role of the border). Want to know which things can be 100% relied upon.

asked 31 Jan '11, 19:12

askokov's gravatar image

askokov
16112
accept rate: 0%

edited 25 Jul '13, 21:41

aseerel4c26's gravatar image

aseerel4c26 ♦
31.9k16237548


The only reliable way to find all the towns and villages in a particular area is to treat the data as a spatial dataset and calculate the results using the coordinates. OSM data does not, and usually should not, have a hierarchy of places like you describe.

You should first describe the area that you are interested in in terms of a polygon of coordinates, then use that polygon with a suitable planet file extract and osmosis to generate data within that polygon. You can then find all the towns, villages etc by filtering for the nodes, and ways containing nodes, that you have within your area.

For most search / hierarchy challenges like this I would suggest starting with the nominatim software, which does all this processing for you.

permanent link

answered 01 Feb '11, 09:07

Andy%20Allan's gravatar image

Andy Allan
11.7k23121142
accept rate: 29%

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:

×98
×80
×71
×43
×6

question asked: 31 Jan '11, 19:12

question was seen: 6,058 times

last updated: 25 Jul '13, 21:41

powered by OSQA