RU:Сервис YOURS

From OpenStreetMap Wiki
Jump to navigation Jump to search

broom

Help (89606) - The Noun Project.svg

Быстрые ссылки
Живая демонстрация
Движок маршрутизации
Служба индексирования
Профили высот
Routing Benchmarks

Еще один сервис маршрутизации OpenStreetMap. Yet another OpenStreetMap Route Service.

Введение

Цель YOURS заключается в использовании данных OpenStreetMap для создания сайта маршрутизации, как и многие другие (OpenSource) приложения. В настоящее время интегрированные приложения:

Название

Есть уже целый ряд услуг с использованием данных OSM для маршрутизации и становится все труднее найти подходящую программу/название проекта. Каждый из них содержит в названии соответствующие слова, как "открытый", "сервис", "маршрут", и т.д. Так я думал о 'Yet Another OpenStreetMap Routing Service', коротко YAORS, которая звучит как "ваш"(YOURS)... Ну что ж :-)

Особенности

  • Создание быстрых и коротких маршрутов в различных режимах:
    • с использованием всех имеющихся дорог для автомобилей, велосипедов и пешеходов.
    • с использованием только национальных, региональных или местных маршрутов/сетей для велосипедов.
  • Неограниченное количество промежуточных пунктов (точек), чтобы делать сложные маршруты.
  • Перетягивание мышкой точек движения.
  • Перетягивание мышкой точек для упорядочивания.
  • Географическое положение: поиск улиц и топонимов по их координатам.
  • Обратная геолокация: поиск координаты по улицам и топонимам.
  • Создание профилей высот маршрута.
  • Скачивание маршрута как файла GPX. Так маршрут можно скинуть на устройство GPS для собственного пользования.
  • Содержит API расчета маршрутизации, который возвращает KML или GeoJSON.
  • Разрешает быстрое редактирование текущего вида карты со ссылкой на редактор карт онлайн 'Potlatch'.
  • Тестирование данных карты\маршрута в одно касание.
  • Показывает дату последнего файла планеты, на котором основана база данных маршрутизации.
  • Кэширование маршрута на стороне клиента (на основе сессии).
  • Автоматическое масштабирование расположения пользователя на основе geoIP.

Сравните YOURS и другие онлайн сайты навигации OpenStreetMap.

Развитие

YOURS код доступен под лицензией BSD. Вы можете скачать код для версии 1 (как на http://www.yournavigation.org) с SVN сервера OpenStreetMap:

 svn co http://svn.openstreetmap.org/applications/routing/yours/branches/version-1.0-via

Контакты, сообщения об ошибке и пожелания

Отчет об ошибке и пожелания желательно сделать как Trac tickets предназначеный для проекта YOURS. Вы также можете добавить свои комментарии на странице обсуждения или в теме форума. Для других вещей Вы можете написать мне: OSM собака na1400 точка info, но я также часто присутствую на IRC-каналах #osm и #osm-dev между 09:00 и 23:00 по центральноевропейскому времени.

Вклад

Любая помощь в развитии YOURS приветствуется! Пожалуйста, оформляйте запрос при совершении изменения так:

 Added new feature blah (refs #1234)

Где 1234 это номер тикета запрашивающего новую функцию или отчет об ошибке

Известные проблемы

Существует список активных тикетов. Список неоптимальных или странных маршрутов перечисленных здесь.

  • Очень длинные маршруты не могут быть экспортированы в формате GPX. Это требует иного подхода реализации (YOURS).
  • Маршрутизация с учётом высот работает для путей с менее чем 400 точек (YOURS).
  • Gosmore не предназначен для генерации очень длинных маршрутов(> 200km).
  • Нет маршрутизации в северо-восточной части американского континента (сервер/хостинг).
  • В связи с серверными ограничениями американский континент разделен на три части: северная, северо-западная и южная Америка. Расчеты не могут быть выполнены, когда маршрут проходит от одного участка к другому (Server/hosting/YOURS).
  • Нестандартные ASCII символы в настоящее время не поддерживается интерфейсом YOURS Namefinder. Я полагаю, это влияет множество не-западных стран, но пока я только получил отзыв по этому из Германии и Дании ...(YOURS).
  • Односторонние ограничения на дорогах отмеченных использованием OneWay=True не учитываются (Gosmore).
  • Некоторые маршруты не могут быть просчитаны (Gosmore).
  • Internet Explorer не показывает график маршрута с высотами (YOURS). Исправлено благодаря Tobias Lindh.

Профиль высот

Профиль высот основан на данных SRTM которые состоят из нескольких терабайт данных при охвате всего мира, но спонсорские серверы обычно не имеют пространства необходимого для хранения нужного количества данных. Возможным решением для этого является распространение данных по нескольким серверам. Ниже приведен список поддерживаемых YOURS серверов. Пожалуйста, пришлите мне сообщение, если вы настроили сервер у себя и хотите поддержать YOURS тоже. Если вы решили настроить сервер убедитесь, что перекрытие соседних областей составляет хотя бы 1 градус, что и сделает генерацию профилей легче.

Сервер Базовый URL Описание района Границы района
Metacarta http://labs.metacarta.com/altitude/profile/ Северная и Южная Америка N60 W-179 S-56 E-44
Komяpa http://altitude.komzpa.net/profile/ Белоруссия N57 W23 S50 E33

Веб-сайт

Инструкции по установке

Необходимые условия

  • Я предполагаю, что веб-сервер с PHP уже имеется. Если нет, существуют много учебных пособий в интернете о том, как это сделать.
  • You will also need php5-curl for Curl integration (used by the cross-domain proxy transport.php)
  • SVN tools are needed to get a copy from the repository. Contact me for a zip file if you don't have (or want) SVN tools installed.
  • Используйте браузер Firefox с плагином Firebug для отладки приложения. Вы узнаете об ошибках, и это будет быстрый путь.

Установка движка маршрутизации Gosmore

  • Для получения копии Gosmore следуйте инструкциям: Gosmore
  • Скачайте скомпилированную карту, как описано в ссылке выше, назовите её gosmore.pak и положите в тот же каталог, в котором находится Gosmore.
  • Или же вы можете скачать дамп планеты или часть планеты из: Planet и сконвертировать его в gosmore.pak следуя инструкциям Вики на странице Gosmore.

Установка веб-сайта YOURS

  • Перейдите к открытому каталогу HTML и получите копию YOURS с помощью команды SVN:
    svn co http://svn.openstreetmap.org/applications/routing/yours/trunk/www yours

Теперь у вас есть каталог с именем 'yours' в открытом каталоге HTML.

  • Open gosmore.php in the API directory, e.g.: yours/api/dev/gosmore.php and put the correct path the the yours www directory ($www_dir), the path to the gosmore routing engine ($yours_dir) and an email address for the administrator (only used to notify API abusers) so you may leave it blank.

Finally

Start your browser and go to: http://www.my-server.com/yours and enjoy!

Embedding YOURS into 3rd party web application

It's fairly easy to get routing in your own web application. Determine the TO and FROM coordinates and ask www.yournavigation.org to calculate a route for you. Have a look at the API documentation for more information on the parameters and it's usage.

Cross-site AJAX calls

Browsers don't allow cross-site AJAX calls (it's a security restriction). There are two possible solutions for this:

  1. Relay the request to www.yournavigation.org via a proxy on your own server.
  2. Use a 3rd party JavaScript library that uses tricks to perform cross-site AJAX requests. E.g. by using a Flash or Java applet.

Option 1 is probably easiest to understand and implement. There are many proxy's available on the internet, but the YOURS repository already contains a proxy for cross-site calls: Transport.php

Once you have the proxy in place on your server then you can request a route using an AJAX call like this (untested!):

var url = 'http://www.my-server.com/yours/transport.php?url=http://www.yournavigation.org/api/1.0/gosmore.php&format=kml&flat=52.215676&flon=5.963946&tlat=52.2573&tlon=6.1799&v=motorcar&fast=1&layer=mapnik';

Notice the replacement of 'gosmore.php?' with 'gosmore.php&' compared to regular URL constructions when using the proxy script in the example above.

Note: This proxy script needs the CURL plugin for PHP.

Websites that run their own instance of YOURS

Please add your website here

API documentation

If you would like to embed some of the functions of the YOURS website in your own site or application then you can incorporate the API. The API is described below.

Usage

Use of the API is on a Fair Use Policy basis: everyone can use the API as long as it won't overload the server systematically. If you do overload but provide an X-Yours-client header (as described below) then I'll try to contact you to find a solution. If you don't provide this information (or I can't contact you) then you might become blocked (this has happened only once so far, so don't worry too much about it).

Speed/Reliability

The sponsored server that runs www.yournavigation.org only has 2 GB ram but the routing database is about 12 GB. This forces the server to move blocks of data in and out of ram when there are multiple concurrent users that request routes all over the world. Despite the speed with which Gosmore is able to calculate routes in optimal conditions, the harddisk seeks will slow the server down almost completely in case of such situation and new requests might be rejected if there are already too many concurrent requests running (this happens quite often unfortunately, multiple times per day). There is not much that can be done about it unless the server is upgraded with more ram and/or an SSD harddisk (Hint!).

API revisions

The API can have multiple revisions. In each version the interface is kept unchanged to prevent 3rd party applications from becoming broken. Each API version is kept in it's own directory which allows multiple API versions to operate simultaneously without interfering with each other. 3rd party developers can then gradually move from one version to another without being forced to do so on short notice. Note: The API interface can change without notice as long as it's called 'dev'.

The current API revision is '1.0'. The 2.0 API is being developed as 'dev'. The base URL for each API is: http://www.yournavigation.org/api/, so the 1.0 API is located at: http://www.yournavigation.org/api/1.0/ and the dev API is located at: http://www.yournavigation.org/api/dev/.

Version 1.0

Clients of this API version are kindly requested to identify themselves using an extra HTTP header: X-Yours-client. This way the (amount of) users can be tracked and appropriate action taken if a 3rd party application is overloading the service or otherwise misbehaving. E.g. the yournavigation website is identified by X-Yours-client: www.yournavigation.org.

Routing API

The routing API provides routing information based upon a given start/end location and some route parameters like the vehicle type, etc. The resulting route is returned as a KML file containing all the nodes from start to finish. If Gosmore is unable to successfully calculate a route then the most complete route so far will be returned.

Base URL

http://www.yournavigation.org/api/1.0/gosmore.php

Parameters

Available parameters are described below. Only the location parameters are required. All other parameters are optional, they will use the default value when omitted.

  • flat = latitude of the starting location.
  • flon = longitude of the starting location.
  • tlat = latitude of the end location.
  • tlon = longitude of the end location.
  • v = the type of transport, possible options are: motorcar, bicycle or foot. Default is: motorcar.
  • fast = 1 selects the fastest route, 0 the shortest route. Default is: 1.
  • layer = determines which Gosmore instance is used to calculate the route. Provide mapnik for normal routing using car, bicycle or foot. Provide cn for using bicycle routing using cycle route networks only. Default is: mapnik.
  • format = specifies the format (KML or geoJSON) in which the route result is being sent back to the client. This can either be kml or geojson. Default is: kml.

Example URL

http://www.yournavigation.org/api/1.0/gosmore.php?format=kml&flat=52.215676&flon=5.963946&tlat=52.2573&tlon=6.1799&v=motorcar&fast=1&layer=mapnik

Export API

YOURS can export a route in different formats, like Waypoints or GPX track. Provide the route and it will return the route in the requested format.

Base URL

http://www.yournavigation.org/api/1.0/saveas.php

Parameters

  • type = the type of output format, possible options are: gpx (GPX track), wpt (Waypoints).
  • data = the source route in lat/lon pairs. Each pair is separated by a comma character while the lat/lon values are separated by a space character.

Example URL

http://www.yournavigation.org/api/1.0/saveas.php?type=gpx&data=5.62373%2053.01,5.62359%2053.01014,5.62336%2053.01024,5.62314%2053.010303

API users

Please add your service here as well

  • The YOURS demonstration site.
  • Woophoo mobile GPS tracking system.
  • Tracks4Bikers Mountaibike tracks site.
  • Aosm routing application running on J2ME and BlackBerry devices.
  • MGMaps Lib Mobile Mapping SDK from Nutiteq, as sample directions service (J2ME, BlackBerry, Android devices).
  • Maemo mapper Maemo mapper OSM routing script. (Note: Does not seem to be using YOURS anymore)
  • OpenMaps is an iPhone maps application.
  • OpenSatNav is an Android navigation application.
  • OpenVoiceNav is an navigation application for the visually impaired.
  • gvSIG mini is a map viewer for mobile phones, that displays existing free maps tiles services, such as OpenStreetMap, Yahoo Maps, Microsoft Bing and more.
  • MySpeed is an Android navigation application with speed logging and speed camera alerts.
  • Parkenapp is a routing application for the iPhone specifically targetting parking needs (in German)
  • OpenMobileMaps is a map viewer application for Windows Mobile phones as an alternative to Google Maps.
  • AndRoad is an OpenStreetMap-based navigation app for Android.
  • PocketNavigator enables you to navigate in a foreign city without forcing you to repetetive look on your device as a usual navigation system would do.
  • TangoGPS is an easy to use, fast and lightweight mapping application for use with or without GPS. It runs on any Linux platform from the desktop over eeePC down to phones like the Openmoko Neo.

Todo list