Уважаемые коллеги! Я хочу сделать парсер и получить из 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 aseerel4c26 ♦ |
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. answered 01 Feb '11, 09:07 Andy Allan |