メインコンテンツまでスキップ

Use Atlas with third-party products

Create a WMS from Atlas using MapProxy

Web Map Service (WMS) is a standard protocol for serving georeferenced map images. These images are commonly produced by a map server from data provided by a GIS database. With Atlas, you can serve WMS sources by using MapProxy and the Mapbox Static Tiles API.

MapProxy is an open source proxy for geospatial data that you’ll point to the Mapbox Static Tiles API. As WMS requests come in, MapProxy makes a request to Atlas, saves the tile in the cache, and then serves it.

Atlas server (left) with MapProxy WMS Viewer pointed at Atlas server (right)

Create a new virtual environment

This setup assumes that Atlas is running and accessible by the MapProxy host. With this installation method, MapProxy is installed on the same host as Atlas. You will need a working Python installation (version 2.7 and 3.4 or higher) to use MapProxy. For more information, see official MapProxy installation documentation.

Create a new virtual environment. To do this you will need virtualenv installed.

virtualenv --system-site-packages mapproxy

Activate the MapProxy virtual environment:

source mapproxy/bin/activate

Install dependencies

For more information, see official MapProxy Dependency details documentation.

Debian or Ubuntu system

Install required dependencies:

sudo apt-get install python-pil python-yaml libproj12

macOS

Install required dependencies:

pip install Pillow PyYAML pyproj

Install MapProxy

Install MapProxy with pip:

pip install MapProxy

Verify installation was successful:

mapproxy-util --version

You should see something like:

MapProxy 1.12.0

Create a new MapProxy service

mapproxy-util create -t base-config mymapproxy
cd mymapproxy/
cp mapproxy.yaml mapproxy.yaml-orig

Use the following configuration values in mapproxy.yaml to access the Mapbox Static Tiles API and generate a WMS from the Mapbox Streets tileset.

  • Replace your-atlas-url with the MapProxy-accessible URL of the Atlas server. If MapProxy and Atlas are running on the same server, this should be [atlasProtocol]://localhost:[atlasPort] which is the default Atlas URL in this scenario.
  • Replace your-atlas-public-token with your public token, which is located in your Atlas account dashboard.
services:
demo:
kml:
wmts:
wms:
md:
title: MapProxy Atlas Server WMS Proxy
abstract: MapProxy and Atlas Server example

layers:
- name: mapbox-streets
title: Mapbox Atlas Server - Streets
sources: [mb_street]

caches:
mb_street:
grids: [webmercator]
sources: [mb_street_tiles]


sources:
mb_street_tiles:
type: tile
grid: GLOBAL_WEBMERCATOR
url: <your-atlas-url>/styles/v1/mapbox/streets-v10/tiles/256/%(z)s/%(x)s/%(y)s?access_token=<your-atlas-public-token>

grids:
webmercator:
base: GLOBAL_WEBMERCATOR
origin: 'nw'
tile_size: [256,256]

Start your Atlas server if it is not already running:

cd atlas-server
./atlas.sh start

Once the config mapproxy.yaml file is saved, start the MapProxy server:

mapproxy-util serve-develop -b 0.0.0.0 mapproxy.yaml

Access the native MapProxy WMS Viewer

Replace your-ip-address with your MapProxy server address (for example, localhost:8080):

http://<your-ip-address>/demo/?srs=EPSG%3A900913&format=image%2Fjpeg&wms_layer=mapbox-streets

Access MapProxy WMS GetCapabilites

Use the GetCapabilites request to access information about a WMS service, including supported image formats and available map layers.

http://<your-ip-address>/service?REQUEST=GetCapabilities
このpageは役に立ちましたか?