[MapProxy] French IGN WMTS configuration in MapProxy
Antoine JAMMES
antoine.jammes at gmail.com
Wed Jan 16 02:33:34 PST 2013
Jeff Konnen <jaykayone <at> gmail.com> writes:
>
.....
> _______________________________________________
> MapProxy mailing list
> MapProxy <at> lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapproxy
>
Hi,
i'm trying to setup mapproxy to serve ign wmts tiles,
So I write this mapproxy.yaml file :
services:
demo:
kml:
tms:
wmts:
wms:
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 Here
position: Technical Director
organization:
address: Fakestreet 123
city: Somewhere
postcode: 12345
country: Germany
phone: +49(0)000-000000-0
fax: +49(0)000-000000-0
email: info at omniscale.de
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:
- name: gpp-ortho
title: Mon ortho geoportail
sources: [geoportail_cache]
caches:
geoportail_cache:
grids: [GLOBAL_MERCATOR]
sources: [geoportail]
sources:
geoportail:
type: tile
url:
http://login:mdp@@gpp3-wxs.ign.fr/<key>/wmts?SERVICE=WMTS&REQUEST=GetTil
e&VERSION=1.0.0&LAYER=ORTHOIMAGERY.ORTHOPHOTOS&TILEMATRIXSET=PM&TILEMATR
IX=%(z)s&TILEROW=%(y)s&TILECOL=%(x)s&FORMAT=image/jpeg&STYLE=normal
http:
ssl_no_cert_checks: True
grids:
global_geodetic_sqrt2:
base: GLOBAL_GEODETIC
res_factor: 'sqrt2'
pseudo_mercator:
srs: 'EPSG:3857'
bbox: [-20037508.34, -20037508.34, 20037508.34, 20037508.34]
origin: nw
mygrid:
srs: EPSG:900913
bbox: [-20037508,-20037508,20037508,20037508]
bbox_srs: EPSG:3857
origin: nw
res:
[156543.0339280410,78271.5169640205,39135.7584820102,19567.8792410051,97
83.9396205026,4891.9698102513,2445.9849051256,1222.9924525628,611.496226
2814,305.7481131407,152.8740565704,76.4370282852,38.2185141426,19.109257
0713,9.5546285356,4.7773142678,2.3886571339,1.1943285670,0.5971642835,0.
2985821417,0.1492910709,0.0746455354]
tile_size: [256,256]
globals:
# # coordinate transformation options
# srs:
# # WMS 1.3.0 requires all coordiates in the correct axis order,
# # i.e. lon/lat or lat/lon. Use the following settings to
# # explicitly set a CRS to either North/East or East/North
# # ordering.
# axis_order_ne: ['EPSG:9999', 'EPSG:9998']
# axis_order_en: ['EPSG:0000', 'EPSG:0001']
# # you can set the proj4 data dir here, if you need custom
# # epsg definitions. the path must contain a file named 'epsg'
# # the format of the file is:
# # <4326> +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs <>
# proj_data_dir: '/path to dir that contains epsg file'
# # cache options
cache:
# where to store the cached images
base_dir: './cache_data'
# where to store lockfiles
lock_dir: './cache_data/locks'
# # request x*y tiles in one step
# meta_size: [4, 4]
# # add a buffer on all sides (in pixel) when requesting
# # new images
# meta_buffer: 80
# image/transformation options
image:
resampling_method: nearest
# resampling_method: bilinear
# resampling_method: bicubic
# jpeg_quality: 90
# # stretch cached images by this factor before
# # using the next level
# stretch_factor: 1.15
# # shrink cached images up to this factor before
# # returning an empty image (for the first level)
# max_shrink_factor: 4.0
using
sources:
geoportail:
type: tile
url:
http://login:mdp@@gpp3-wxs.ign.fr/<key>/wmts?SERVICE=WMTS&REQUEST=GetTil
e&VERSION=1.0.0&LAYER=ORTHOIMAGERY.ORTHOPHOTOS&TILEMATRIXSET=PM&TILEMATR
IX=%(z)s&TILEROW=%(y)s&TILECOL=%(x)s&FORMAT=image/jpeg&STYLE=normal
It doesnt works :
[2013-01-16 10:58:03,800] mapproxy.config - INFO - reading:
/home/guest832/Bureau/mapproxy/virtualenv/mymapproxy/mapproxy.yaml
Traceback (most recent call last):
File "/home/guest832/Bureau/mapproxy/virtualenv/mapproxy/bin/mapproxy-
util",
line 9, in <module>
load_entry_point('MapProxy==1.5.0', 'console_scripts', 'mapproxy-uti
l')()
File
"/home/guest832/Bureau/mapproxy/virtualenv/mapproxy/lib/python2.7/site-p
ackages/mapproxy/script/util.py",
line 337, in main
commands[command]['func'](args)
File
"/home/guest832/Bureau/mapproxy/virtualenv/mapproxy/lib/python2.7/site-p
ackages/mapproxy/script/util.py",
line 76, in serve_develop_command
app = make_wsgi_app(mapproxy_conf, debug=options.debug)
File
"/home/guest832/Bureau/mapproxy/virtualenv/mapproxy/lib/python2.7/site-p
ackages/mapproxy/wsgiapp.py",
line 100, in make_wsgi_app
services = conf.configured_services()
File
"/home/guest832/Bureau/mapproxy/virtualenv/mapproxy/lib/python2.7/site-p
ackages/mapproxy/config/loader.py",
line 206, in configured_services
return self.services.services()
File
"/home/guest832/Bureau/mapproxy/virtualenv/mapproxy/lib/python2.7/site-p
ackages/mapproxy/config/loader.py",
line 1208, in services
new_services = creator(service_conf or {})
File
"/home/guest832/Bureau/mapproxy/virtualenv/mapproxy/lib/python2.7/site-p
ackages/mapproxy/config/loader.py",
line 1296, in wms_service
tile_layers = self.tile_layers(conf)
File
"/home/guest832/Bureau/mapproxy/virtualenv/mapproxy/lib/python2.7/site-p
ackages/mapproxy/config/loader.py",
line 1227, in tile_layers
for tile_layer in layer_conf.tile_layers():
File
"/home/guest832/Bureau/mapproxy/virtualenv/mapproxy/lib/python2.7/site-p
ackages/mapproxy/util/__init__.py",
line 86, in wrapper
func.__memoize_cache[key] = func(*args)
File
"/home/guest832/Bureau/mapproxy/virtualenv/mapproxy/lib/python2.7/site-p
ackages/mapproxy/config/loader.py",
line 1172, in tile_layers
for grid, extent, cache_source in self.context.caches[cache_name].ca
ches():
File
"/home/guest832/Bureau/mapproxy/virtualenv/mapproxy/lib/python2.7/site-p
ackages/mapproxy/util/__init__.py",
line 86, in wrapper
func.__memoize_cache[key] = func(*args)
File
"/home/guest832/Bureau/mapproxy/virtualenv/mapproxy/lib/python2.7/site-p
ackages/mapproxy/config/loader.py",
line 1004, in caches
source = source_conf.source({'format': request_format})
File
"/home/guest832/Bureau/mapproxy/virtualenv/mapproxy/lib/python2.7/site-p
ackages/mapproxy/config/loader.py",
line 811, in source
http_client, url = self.http_client(url)
File
"/home/guest832/Bureau/mapproxy/virtualenv/mapproxy/lib/python2.7/site-p
ackages/mapproxy/config/loader.py",
line 515, in http_client
url, (username, password) = auth_data_from_url(url)
File
"/home/guest832/Bureau/mapproxy/virtualenv/mapproxy/lib/python2.7/site-p
ackages/mapproxy/client/http.py",
line 184, in auth_data_from_url
auth_data, host = host.split('@', 2)
ValueError: too many values to unpack
I guess the problem come from the login that is an email (ie with an @)
So I have change the method auth_data_from_url(url) of
mapproxy/lib/python2.7/site-packages/mapproxy/client/http.py
replacing :
def auth_data_from_url(url):
"""
>>> auth_data_from_url('http://localhost/bar')
('http://localhost/bar', (None, None))
>>> auth_data_from_url('http://bar@localhost/bar')
('http://localhost/bar', ('bar', None))
>>> auth_data_from_url('http://bar:baz@localhost/bar')
('http://localhost/bar', ('bar', 'baz'))
"""
username = password = None
if '@' in url:
scheme, host, path, query, frag = urlsplit(url)
if '@' in host:
auth_data, host = host.split('@', 2)
url = url.replace(auth_data+'@', '', 1)
if ':' in auth_data:
username, password = auth_data.split(':', 2)
else:
username = auth_data
return url, (username, password)
by :
def auth_data_from_url(url):
"""
>>> auth_data_from_url('http://localhost/bar')
('http://localhost/bar', (None, None))
>>> auth_data_from_url('http://bar@localhost/bar')
('http://localhost/bar', ('bar', None))
>>> auth_data_from_url('http://bar:baz@localhost/bar')
('http://localhost/bar', ('bar', 'baz'))
"""
username = password = None
if '@' in url:
scheme, host, path, query, frag = urlsplit(url)
if '@' in host:
sep = host.rfind("@")
auth_data = host[:sep]
host = host[sep +1:]
if ':' in auth_data:
username, password = auth_data.split(':', 2)
else:
username = auth_data
return url, (username, password)
Unfortunately it is inssufisant it steel dont work I had now this error:
[2013-01-16 11:11:25,043] mapproxy.source.tile - WARNING -
could not retrieve
tile: Internal HTTP error
"https://email:mdp@gpp3-wxs.ign.fr/<key>/wmts?SERVICE=WMTS&REQUEST=GetTi
le&VERSION=1.0.0&LAYER=ORTHOIMAGERY.ORTHOPHOTOS&TILEMATRIXSET=PM&TILEMAT
RIX=1&TILEROW=1&TILECOL=1&FORMAT=image/jpeg&STYLE=normal":
InvalidURL("nonnumeric port: 'email:mdp at gpp3-wxs.ign.fr'",)
so I try this url (with the standard https port 443)
url:
https://email:mdp@gpp3-wxs.ign.fr:443/<key>/wmts?SERVICE=WMTS&REQUEST=Ge
tTile&VERSION=1.0.0&LAYER=ORTHOIMAGERY.ORTHOPHOTOS&TILEMATRIXSET=PM&TILE
MATRIX=%(z)s&TILEROW=%(y)s&TILECOL=%(x)s&FORMAT=image/jpeg&STYLE=normal
and I get :
[2013-01-16 11:16:20,438] mapproxy.source.tile - WARNING -
could not retrieve
tile: No response from URL
"https://email:mdp@gpp3-wxs.ign.fr:443/<key>/wmts?SERVICE=WMTS&REQUEST=G
etTile&VERSION=1.0.0&LAYER=ORTHOIMAGERY.ORTHOPHOTOS&TILEMATRIXSET=PM&TIL
EMATRIX=1&TILEROW=0&TILECOL=0&FORMAT=image/jpeg&STYLE=normal":
Name or service not known
So I cry.
Could you help me ?
Does it works for you ?
Do you have a login with an '@' ?
Witch mapproxy do you use ?
More information about the MapProxy
mailing list