Поиск по этому блогу

Показаны сообщения с ярлыком mapproxy. Показать все сообщения
Показаны сообщения с ярлыком mapproxy. Показать все сообщения

среда, 12 сентября 2018 г.

mapproxy настройка для работы с osm

Здравствуйте!

Помимо установки mapproxy требуется так же настроить подключение к osm tiled серверу для загрузки готовых png.

инструкция, установка, gis, linux, mapproxy, ubuntu, osm,

Можно использовать готовый файл настройки с официального вики osm ( заменяем содержимое mapproxy.yaml в директории mymapproxy ):

services:
  #sets up how to make the source data available
  demo:
  tms:
  wms:
    #srs sets the coordinate reference systems as which you want to make your data available. MapProxy reprojects the source data very well to these projections.
    srs: ['EPSG:900913','EPSG:3857']
    image_formats: ['image/jpeg', 'image/png']
    md:
      # metadata used in capabilities documents
      title: MapProxy WMS Proxy
      abstract: This is the fantastic MapProxy.
      online_resource: http://mapproxy.org/
      contact:
        person: Your Name
        position: Technical Director
        organization: Some Company
        address: Long street
        city: Timbuktu
        postcode: 123456AD
        country: South Pole
        email: info@example.com
      access_constraints:
        This service is intended for private and evaluation use only.
        The data is licensed as Creative Commons Attribution-Share Alike 2.0
        (http://creativecommons.org/licenses/by-sa/2.0/)
      fees: 'None'

layers:
  #sets up which layers you want to make available using the services above. You can add many, but let's stick to osm data here.
  - name: osm
    title: Open Streetmap Tiles
    sources: [osm_cache] #this layer should use the osm_cache (defined below) as it's source.
   
caches:
  #setup the cache for the open streetmap tiles. This cache is used by the layer above.
  osm_cache:
    sources: [osm_tiles] #here you set what source data (defined below) you want to cache
    format: image/png
 
sources:
   osm_tiles:
     #the osm_tiles source refers to the openstreetmap.org tiles. These will be downloaded upon request (if not already cached) and served by MapProxy
     type: tile
     url: http://c.tile.openstreetmap.org/%(tms_path)s.%(format)s
     grid: osm_grid #the grid to use for the osm tiles. This is really important. It is specified below.

grids:
  osm_grid:
    #this srs and origin specify a grid that can be used elsewhere in the configuration. In this example it is used for the osm_tiles source. These settings are correct for openstreetmap.org tiles.
    #The google mercator srs is used (also called EPSG:900913), and the origin of the tiles is north-west). If you get this wrong, you might very well get an all-blue world.
    srs: EPSG:900913
    origin: nw

globals:
  #next are some global configuration options for MapProxy. They mostly explain themselves, or can be looked-up in the MapProxy docs.
  cache:
    # where to store the cached images
    base_dir: './cache_data'
    # where to store lockfiles
    lock_dir: './cache_data/locks'


  # image/transformation options
  image:
      resampling_method: bilinear
      jpeg_quality: 90

После замены не забываем перезапустить сервер и данные начнут загружаться при обращении.

Надеюсь инсутрукция была полезной.
Успехов и хорошего дня!

вторник, 11 сентября 2018 г.

mapproxy установка на ubuntu server

Здравствуйте!

При работе с OpenStreet map и так себе интернете зачастую встаёт вопрос о локальной копии требуемых данных. Для этого могут использоваться несколько вариантов: wmts, tiled, wms сервера. Tiled самый сложный по нагрузке но и самый производительный ведь содержит шейпы, векторную базу и отрендеренные png файлы. Но очень мало gis п.о. поддерживают подгрузку.


В данном случае чаще используется wms сервер и наиболее удобным я считаю mapproxy. Быстрая установка и надёжная работа ( не валится при глюках osm ).

Для его установки требуется ( все действия от рута ):

  1. apt-get update && apt-get upgrade
  2. sudo apt-get install python-virtualenv
  3. virtualenv --system-site-packages mapproxy
  4. apt-get install build-essential python-dev libjpeg8-dev zlib1g-dev libfreetype6-dev python-yaml
  5. apt-get install libgeos-dev python-lxml libgdal-dev python-shapely
  6. cd ~
  7. Не забываем точку в начале затем пробел: . mapproxy/bin/activate
  8. pip install Pillow
  9. pip install MapProxy
  10. После этого шага можно проверить корректную установку. Команда mapproxy-util --version должна вывести текущую версию установленного mapproxy.
  11. На этом установка завершена. Далее требуется создать тестовый конфиг для mapproxy: mapproxy-util create -t base-config mymapproxy

У root в cd ~ должны появиться 2 папки. mapproxy содержащая установленный сервер и mymapproxy с вашим конфигом.
Для запуска сервера требуется зайти под рутом и выполнить:

  1. cd mymapproxy
  2. mapproxy-util serve-develop -b ИПСЕРВЕРА mapproxy.yaml

Для проверки и просмотра кэша перейдите по адресу
http://ИПСЕРВЕРА:8080/demo
Для подключения используйте ссылку вида:
http://ИПСЕРВЕРА:8080/service?REQUEST=GetCapabilities

Надеюсь инструкция пригодилась.
Успехов и хорошего дня!