Конвертер OSM -> MP

Потихоньку начал глобальный рефакторинг конвертера, а то там полный ужос-ужос.
Уже сделано:

  • единый скрипт развален на модули (уже давно перерос тот формат)
  • исходный .osm теперь читается стандартным xml-парсером в один проход - должно стать быстрее, и можно подавать вход на stdin
  • поменялся формат мастер-конфига, теперь это обычный ini, и в него вынесены дефолтные опции; остальное осталось в yaml
  • сильно поменялись внутренности обработки фич-конфигов (должно стать побыстрее и построже), но внешне они остались почти такими же
  • остальное (в том числе генерация роутинга) по возможности оставлено нетронутым, хотя там ещё разгребать и разгребать…
  • и это только начало :slight_smile:

Новые фичи пока все в статусе беты, использовать с осторожностью.

getbound.pl RU-MOS > RU-MOS.poly
Downloading RelID=51490…Failed

таймаут 900 поставил, не помогло. Хотя ID верный. :expressionless:
И ещё в aliases.yml неверно указаны ID Мурманской и Тверской областей, должно быть 2099216 и 2095259 соответственно.

Это апи падает, внешним таймаутом тут не поможешь.
http://www.openstreetmap.org/api/0.6/relation/51490/full
Если не вылечится, придётся что-то придумывать.

спасибо, поменял

Уже пора придумывать, ибо есть релейшены, которые не качаются хронически. У Gryphon есть некий питоновский скрипт, который качает как-то подругому и потом скармливает результат твоему скрипту. Может их как-то объединить в единый инструмент?

Придумать-то несложно, но по-хорошему надо лечить апи, а не навешивать ещё одно кольцо костылей.
/full - вполне официальный метод, ограничения у него не описаны - значит, должен работать.

liosha
С причинами разобрались, а как быть то?

Я ж говорю, по-хорошему надо пинать админов со словами “чё за фигня, почему апи падает?!”

Пнул, вот ответ:

Да кто б сомневался, что это таймаут…
То есть, я так понимаю, чинить это они не собираются.

Ну может надо как то по особому пинать, я в английском не силён. Писал на webmaster@openstreetmap.org

Добавил возможность скачать большие релейшены по частям.
getbound теперь вынесен в самостоятельный проект: http://code.google.com/p/osm-getbound/

This project currently has no downloads.

Kostik, http://code.google.com/p/osm-getbound/source/browse/#svn%2Ftrunk

liosha
У меня почему то не работает и выдаёт кучу ошибок:


C:\OSM\getbound>getbound.pl RU-MOS  1>RU-MOS.poly
Bareword found where operator expected at C:\OSM\getbound\getbound.pl line 8, ne
ar ""Content-Type" content"
        (Missing operator before content?)
Bareword found where operator expected at C:\OSM\getbound\getbound.pl line 40, n
ear "" rel="stylesheet"
        (Missing operator before stylesheet?)
String found where operator expected at C:\OSM\getbound\getbound.pl line 40, nea
r "stylesheet" href=""
Bareword found where operator expected at C:\OSM\getbound\getbound.pl line 40, n
ear "" href="http"
        (Missing operator before http?)
Having no space between pattern and following word is deprecated at C:\OSM\getbo
und\getbound.pl line 40.
String found where operator expected at C:\OSM\getbound\getbound.pl line 42, nea
r "<link type=""
  (Might be a runaway multi-line "" string starting on line 40)
        (Missing semicolon on previous line?)
Bareword found where operator expected at C:\OSM\getbound\getbound.pl line 42, n
ear "<link type="text"
        (Missing operator before text?)
String found where operator expected at C:\OSM\getbound\getbound.pl line 42, nea
r "css" rel=""
Bareword found where operator expected at C:\OSM\getbound\getbound.pl line 42, n
ear "" rel="stylesheet"
        (Missing operator before stylesheet?)
String found where operator expected at C:\OSM\getbound\getbound.pl line 42, nea
r "stylesheet" href=""
Bareword found where operator expected at C:\OSM\getbound\getbound.pl line 42, n
ear "" href="http"
        (Missing operator before http?)
Having no space between pattern and following word is deprecated at C:\OSM\getbo
und\getbound.pl line 42.
String found where operator expected at C:\OSM\getbound\getbound.pl line 45, nea
r "<link type=""
  (Might be a runaway multi-line "" string starting on line 42)
        (Missing semicolon on previous line?)
Bareword found where operator expected at C:\OSM\getbound\getbound.pl line 45, n
ear "<link type="text"
        (Missing operator before text?)
String found where operator expected at C:\OSM\getbound\getbound.pl line 45, nea
r "css" rel=""
Bareword found where operator expected at C:\OSM\getbound\getbound.pl line 45, n
ear "" rel="stylesheet"
        (Missing operator before stylesheet?)
String found where operator expected at C:\OSM\getbound\getbound.pl line 45, nea
r "stylesheet" href=""
Bareword found where operator expected at C:\OSM\getbound\getbound.pl line 45, n
ear "" href="http"
        (Missing operator before http?)
Having no space between pattern and following word is deprecated at C:\OSM\getbo
und\getbound.pl line 45.
String found where operator expected at C:\OSM\getbound\getbound.pl line 50, nea
r "<link type=""
  (Might be a runaway multi-line "" string starting on line 45)
        (Missing semicolon on previous line?)
Bareword found where operator expected at C:\OSM\getbound\getbound.pl line 50, n
ear "<link type="text"
        (Missing operator before text?)
String found where operator expected at C:\OSM\getbound\getbound.pl line 50, nea
r "css" rel=""
Bareword found where operator expected at C:\OSM\getbound\getbound.pl line 50, n
ear "" rel="stylesheet"
        (Missing operator before stylesheet?)
String found where operator expected at C:\OSM\getbound\getbound.pl line 50, nea
r "stylesheet" href=""
Bareword found where operator expected at C:\OSM\getbound\getbound.pl line 50, n
ear "" href="http"
        (Missing operator before http?)
Having no space between pattern and following word is deprecated at C:\OSM\getbo
und\getbound.pl line 50.
String found where operator expected at C:\OSM\getbound\getbound.pl line 52, nea
r "<style type=""
  (Might be a runaway multi-line "" string starting on line 50)
        (Missing semicolon on previous line?)
Bareword found where operator expected at C:\OSM\getbound\getbound.pl line 52, n
ear "<style type="text"
        (Missing operator before text?)
String found where operator expected at C:\OSM\getbound\getbound.pl line 120, ne
ar "<body class=""
  (Might be a runaway multi-line "" string starting on line 52)
        (Missing semicolon on previous line?)
Bareword found where operator expected at C:\OSM\getbound\getbound.pl line 120,
near "<body class="t4"
        (Missing operator before t4?)
String found where operator expected at C:\OSM\getbound\getbound.pl line 121, ne
ar "<script type=""
  (Might be a runaway multi-line "" string starting on line 120)
        (Missing semicolon on previous line?)
Bareword found where operator expected at C:\OSM\getbound\getbound.pl line 121,
near "<script type="text"
        (Missing operator before text?)
String found where operator expected at C:\OSM\getbound\getbound.pl line 128, ne
ar "<script type=""
  (Might be a runaway multi-line "" string starting on line 121)
        (Missing semicolon on previous line?)
Bareword found where operator expected at C:\OSM\getbound\getbound.pl line 128,
near "<script type="text"
        (Missing operator before text?)
String found where operator expected at C:\OSM\getbound\getbound.pl line 131, ne
ar "{var po = document.createElement(""
  (Might be a runaway multi-line "" string starting on line 128)
        (Missing semicolon on previous line?)
Bareword found where operator expected at C:\OSM\getbound\getbound.pl line 131,
near "{var po = document.createElement("script"
        (Missing operator before script?)
String found where operator expected at C:\OSM\getbound\getbound.pl line 132, ne
ar "po.type = ""
  (Might be a runaway multi-line "" string starting on line 131)
        (Missing semicolon on previous line?)
Bareword found where operator expected at C:\OSM\getbound\getbound.pl line 132,
near "po.type = "text"
String found where operator expected at C:\OSM\getbound\getbound.pl line 132, ne
ar "javascript"; po.async = true;po.src = ""
Bareword found where operator expected at C:\OSM\getbound\getbound.pl line 132,
near ""; po.async = true;po.src = "https"
        (Missing operator before https?)
String found where operator expected at C:\OSM\getbound\getbound.pl line 133, ne
ar "var s = document.getElementsByTagName(""
  (Might be a runaway multi-line "" string starting on line 132)
        (Missing semicolon on previous line?)
Bareword found where operator expected at C:\OSM\getbound\getbound.pl line 133,
near "var s = document.getElementsByTagName("script"
        (Do you need to predeclare var?)
String found where operator expected at C:\OSM\getbound\getbound.pl line 137, ne
ar "<div class=""
  (Might be a runaway multi-line "" string starting on line 133)
        (Missing semicolon on previous line?)
Bareword found where operator expected at C:\OSM\getbound\getbound.pl line 137,
near "<div class="headbg"
        (Missing operator before headbg?)
String found where operator expected at C:\OSM\getbound\getbound.pl line 139, ne
ar "<div id=""
  (Might be a runaway multi-line "" string starting on line 137)
        (Missing semicolon on previous line?)
Bareword found where operator expected at C:\OSM\getbound\getbound.pl line 139,
near "<div id="gaia"
        (Missing operator before gaia?)
String found where operator expected at C:\OSM\getbound\getbound.pl line 144, ne
ar "<a href=""
  (Might be a runaway multi-line "" string starting on line 139)
        (Missing semicolon on previous line?)
syntax error at C:\OSM\getbound\getbound.pl line 6, near "html>"
syntax error at C:\OSM\getbound\getbound.pl line 24, near ""profileUrl":"
syntax error at C:\OSM\getbound\getbound.pl line 34, near "title>"
Excessively long <> operator at C:\OSM\getbound\getbound.pl line 145.

Что-то ты явно не то запускаешь. Больше похожее на html :slight_smile:

Командная строка как-то странно выглядит

liosha
Скачивал по ссылке указанной z3s. Правой кнопкой на файле, сохранить объект как…
А я так понимаю что нужно было открыть и выделить код и сохранить в текстовой файл и переименовать. Сам ступил короче.

Ezhick
Она выглядит так:
getbound.pl RU-MOS > RU-MOS.poly
еденичка как то сама добавляется.

Там же всё написано:
http://code.google.com/p/osm-getbound/source/checkout

liosha
Спасибо, теперь релейшен 51490 выкачивается (частями). Но так и не понял насчёт ключа --onering. Размер файла не меняется что с ключом что без.

Если мне нужно полифайл Московской области (без Москвы) скачать, как должен выглядеть запрос?

getbound.pl --onering RU-MOS > RU-MOS.poly

А если только Москва без области?

getbound.pl RU-MOS всегда будет скачивать МО без Москвы.
Но osm2mp возьмёт из него только 1-й контур, а дырки не заметит.
–onering сделан специально для osm2mp+cgpsmapper, чтобы оно работало с дырками, но с другим софтом работа не гарантируется.