sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get install -y python3-pip
pip3 install --upgrade pip
sudo apt-get install build-essential libssl-dev libffi-dev python-dev
sudo apt-get install -y python3-venv
Let’s choose which directory we would like to put our Python programming environments in, or we can create a new directory with mkdir, as in:
$ mkdir environments $ cd environments
$ python3 -m venv mapproxy
$ source mapproxy/bin/activate
sudo apt-get install python-pil python-yaml libproj12
sudo apt-get install libgeos-dev python-lxml libgdal-dev python-shapely
pip install MapProxy
tips for a test run:
To create a new set of configuration files for MapProxy call:
mapproxy-util create -t base-config mymapproxy
To start a test server:
mapproxy-util serve-develop -b 0.0.0.0 mapproxy.yaml
*need to bind to 0.0.0.0 to display on external clients
created a new config file with the following (from this Github issue: mapproxy/mapproxy#239):
services:
#sets up how to make the source data available
demo:
tms:
wmts:
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/png']
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: OpenStreetmap
sources: [osm_cache]
caches:
#setup the cache for the open streetmap tiles. This cache is used by the layer above.
osm_cache:
disable_storage: true
sources: [osm_tiles]
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://b.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: '/path_to_cache_dir'
# where to store lockfiles
lock_dir: '/path_to_locks/'
Then on openstreetmap.org in edit more added the following url and it worked (note: need to add the '.png' in the end): http://52.91.200.23:8080/tms/1.0.0/osm/EPSG900913/{z}/{x}/{y}.png