RU:Развёртывание собственной Подвижной Карты (Slippy Map)

From OpenStreetMap Wiki
Jump to: navigation, search
Help
Доступные языки
Deutsch English 日本語 Русский
В процессе перевода +/-
Эта страница находится в процессе перевода или помечена для этой цели, поэтому может содержать пропуски, ошибки и непереведённые фрагменты. Исходная статья – Deploying your own Slippy Map.
Если вы знаете английский, то можете помочь нам, переведя часть оригинальной статьи. Общие сведения о переводе статей на русский язык можно найти здесь.

Вы можете закончить перевод

Хотите разместить данные OpenStreetMap на своем сайте?

Вы можете встроить нашу карту в свою страницу, также как и карты Google, Яндекс, Bing или Yahoo! Но для большей гибкости OpenStreetMap дает вам уникальную возможность создать свои фрагменты карты, с каким угодно оформлением на основе наших данных.

Contents

Поместите нашу карту на ваш сайт

Это самый легкий шаг, и вы должны убедиться, что сможете сделать это перед тем, как пытаться сделать что-нибудь ещё. Это можно сделать:

Ваша карта может использовать любые тайлы сервера OSM, хотя имейте в виду, что здесь нет никаких гарантий доступности или качества (если вы ожидаете у себя напряженный трафик, пожалуйста обсудите сначала эту проблему с командой проекта).

Создание собственных квадратов

Если вы хотите сделать карту по-своему — например, с дорогами других цветов и другой толщины — вы можете сделать ее сами. Используйте для этого Mapnik или Osmarender (который встроен в сценарии Tiles@home).

Создание тайлов(квадратов изображений, отображающих карту) используя Mapnik и скрипт generate_tiles.py

Для примера, этот метод используется OSM cycle map. Его главное преимущество в том, что ничего не нужно для его запуска на веб сервере, за исключением наличия некой директории с изображениями. Для примера, вы можете установить весь необходимый софт на свой домашний ПК и затем перекинуть тайлы на ваш вебхост, когда вы их закончите.

Creating tiles using Mapnik and mod_tile

This is the new system deployed on the main OSM map in 2008. It uses a custom C implementation to efficiently serve tiles from the disk and schedule rendering requests.

Creating tiles using Mapnik and Mysql/Ruby/Python

This solution which was in use on the main OSM map for almost all of 2007. The tiles were served by a ruby script which fetched the tiles from a MySQL database. If the tile was old or missing then the database would be updated to mark the tile for rendering. A background script would scan the database and render the tiles using a python script.

 RewriteRule ^//(-?[0-9]+)/(-?[0-9]+)/(-?[0-9]+).png  /ruby/cat_tile.rb?x=$2&y=$3&z=$1 [PT,T=image/png]

Создание частей карты используя Mapnik и tilecache

Этот метод позволяет вам выполнять визуализацию карты в момент её просмотра и не требует предварительной визуализации. В случае, когда много людей одновременно пытаются просмотреть фрагменты карты (тайлы), визуализация которых ещё не была выполнена, этот метод позволяет справляться с такой нагрузкой. Вы только должны обладать полным контролем над вашим web-сервером, чтобы иметь возможность устанавливать то, что вам нужно.

Другой "Как развернуть вашу mapnik карту" с визуализацией в режиме реального времени

Howto real time rendering

Creating tiles with Osmarender/Tiles@Home

Download the latest tiles@home client from SVN (it is called tilesGen.pl). Change the configuration file to include "LocalSlippymap=DirectoryName", and specify a DirectoryName that you want to contain the generated tiles. Whenever you now process a tileset (by running perl tilesGen.pl xy xxxx yyyy, where xxxx and yyyy are the x and y coordinates of the level-12 tile you want to render), tilesGen.pl will create the tiles under the DirectoryName in a directory structure suitable for serving the tiles through a web server. The first directory element will be the layer prefix (as configured in layers.conf, in case you have more than one layer!), then you'll have a zoom level, then the x coordinate, and then a file "y.png".

You will need the script lowzoom.pl to create tiles for zoom levels 11 and smaller from the tiles you have generated. Unsure whether/how this works with LocalSlippymap.

Map Application (UI)

Whether you use Mapnik or Osmarender to generate the tiles, you will need a web interface to browse them.

The logic that does the zooming and panning is usually implemented in Javascript. You can either use OpenLayers, or you could also use the Google API to access the tiles. In both cases you will have to somehow add your layer to the list of layers available for selection, and adding your layer will require specifying the web server and base path — the interface will then add /zoom/x/y.png depending on which tile it needs (See Slippy map tilenames)

We use the OpenLayers javascript for our our main map and also at informationfreeway.org. The OpenLayers 'Getting Started' doc explains how to initialize a 'map' object in javascript. To make this work with our tiling scheme, you need a 'TMS' layer and bit more javascript logic. See our OpenLayers Simple Example. For more slippy map features (supporting layer selector, permalinks, etc) you might like to poke around in the javascript source of informationfreeway.org

Using Kosmos Tile Map Server

If you need a lightweight and simple slippymap solution, you can use Kosmos tile map server to render maps of smaller areas. You just need an OSM file with the map data — you can use JOSM to download the data and then save it to the disk. Kosmos is able to generate tiles automatically on your computer and is also equipped with an OpenLayers-powered slippymap. See Kosmos#Tile_Map_Server for more information.

Примечание

Fedora Users

Personal tools
Namespaces
Variants
Actions
site
Toolbox