MapProxy 1.16.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mapproxy/__init__.py +0 -0
- mapproxy/cache/__init__.py +36 -0
- mapproxy/cache/azureblob.py +145 -0
- mapproxy/cache/base.py +111 -0
- mapproxy/cache/compact.py +664 -0
- mapproxy/cache/couchdb.py +295 -0
- mapproxy/cache/dummy.py +34 -0
- mapproxy/cache/file.py +185 -0
- mapproxy/cache/geopackage.py +609 -0
- mapproxy/cache/legend.py +83 -0
- mapproxy/cache/mbtiles.py +392 -0
- mapproxy/cache/meta.py +78 -0
- mapproxy/cache/path.py +250 -0
- mapproxy/cache/redis.py +88 -0
- mapproxy/cache/renderd.py +95 -0
- mapproxy/cache/riak.py +202 -0
- mapproxy/cache/s3.py +177 -0
- mapproxy/cache/tile.py +699 -0
- mapproxy/client/__init__.py +0 -0
- mapproxy/client/arcgis.py +79 -0
- mapproxy/client/cgi.py +139 -0
- mapproxy/client/http.py +315 -0
- mapproxy/client/log.py +33 -0
- mapproxy/client/tile.py +150 -0
- mapproxy/client/wms.py +254 -0
- mapproxy/compat/__init__.py +46 -0
- mapproxy/compat/image.py +79 -0
- mapproxy/compat/itertools.py +29 -0
- mapproxy/compat/modules.py +13 -0
- mapproxy/config/__init__.py +22 -0
- mapproxy/config/config.py +201 -0
- mapproxy/config/coverage.py +107 -0
- mapproxy/config/defaults.py +98 -0
- mapproxy/config/loader.py +2286 -0
- mapproxy/config/spec.py +644 -0
- mapproxy/config/validator.py +239 -0
- mapproxy/config_template/__init__.py +0 -0
- mapproxy/config_template/base_config/config.wsgi +10 -0
- mapproxy/config_template/base_config/full_example.yaml +593 -0
- mapproxy/config_template/base_config/full_seed_example.yaml +79 -0
- mapproxy/config_template/base_config/log.ini +35 -0
- mapproxy/config_template/base_config/mapproxy.yaml +60 -0
- mapproxy/config_template/base_config/seed.yaml +27 -0
- mapproxy/exception.py +142 -0
- mapproxy/featureinfo.py +252 -0
- mapproxy/grid.py +1170 -0
- mapproxy/image/__init__.py +536 -0
- mapproxy/image/fonts/DejaVuSans.ttf +0 -0
- mapproxy/image/fonts/DejaVuSansMono.ttf +0 -0
- mapproxy/image/fonts/LICENSE +99 -0
- mapproxy/image/fonts/__init__.py +0 -0
- mapproxy/image/mask.py +75 -0
- mapproxy/image/merge.py +316 -0
- mapproxy/image/message.py +347 -0
- mapproxy/image/opts.py +182 -0
- mapproxy/image/tile.py +167 -0
- mapproxy/image/transform.py +350 -0
- mapproxy/layer.py +470 -0
- mapproxy/multiapp.py +231 -0
- mapproxy/proj.py +302 -0
- mapproxy/request/__init__.py +18 -0
- mapproxy/request/arcgis.py +259 -0
- mapproxy/request/base.py +476 -0
- mapproxy/request/tile.py +128 -0
- mapproxy/request/wms/__init__.py +793 -0
- mapproxy/request/wms/exception.py +99 -0
- mapproxy/request/wmts.py +436 -0
- mapproxy/response.py +237 -0
- mapproxy/script/__init__.py +0 -0
- mapproxy/script/conf/__init__.py +0 -0
- mapproxy/script/conf/app.py +195 -0
- mapproxy/script/conf/caches.py +45 -0
- mapproxy/script/conf/layers.py +54 -0
- mapproxy/script/conf/seeds.py +37 -0
- mapproxy/script/conf/sources.py +86 -0
- mapproxy/script/conf/utils.py +143 -0
- mapproxy/script/defrag.py +184 -0
- mapproxy/script/export.py +333 -0
- mapproxy/script/grids.py +188 -0
- mapproxy/script/scales.py +126 -0
- mapproxy/script/util.py +406 -0
- mapproxy/script/wms_capabilities.py +152 -0
- mapproxy/seed/__init__.py +0 -0
- mapproxy/seed/cachelock.py +121 -0
- mapproxy/seed/cleanup.py +187 -0
- mapproxy/seed/config.py +469 -0
- mapproxy/seed/script.py +388 -0
- mapproxy/seed/seeder.py +538 -0
- mapproxy/seed/spec.py +64 -0
- mapproxy/seed/util.py +254 -0
- mapproxy/service/__init__.py +14 -0
- mapproxy/service/base.py +46 -0
- mapproxy/service/demo.py +356 -0
- mapproxy/service/kml.py +331 -0
- mapproxy/service/ows.py +38 -0
- mapproxy/service/template_helper.py +53 -0
- mapproxy/service/templates/demo/capabilities_demo.html +16 -0
- mapproxy/service/templates/demo/demo.html +181 -0
- mapproxy/service/templates/demo/openlayers-demo.cfg +16 -0
- mapproxy/service/templates/demo/static/img/blank.gif +0 -0
- mapproxy/service/templates/demo/static/img/east-mini.png +0 -0
- mapproxy/service/templates/demo/static/img/north-mini.png +0 -0
- mapproxy/service/templates/demo/static/img/south-mini.png +0 -0
- mapproxy/service/templates/demo/static/img/west-mini.png +0 -0
- mapproxy/service/templates/demo/static/img/zoom-minus-mini.png +0 -0
- mapproxy/service/templates/demo/static/img/zoom-plus-mini.png +0 -0
- mapproxy/service/templates/demo/static/img/zoom-world-mini.png +0 -0
- mapproxy/service/templates/demo/static/logo.png +0 -0
- mapproxy/service/templates/demo/static/ol.css +345 -0
- mapproxy/service/templates/demo/static/ol.js +4 -0
- mapproxy/service/templates/demo/static/proj4.min.js +1 -0
- mapproxy/service/templates/demo/static/proj4defs.js +1 -0
- mapproxy/service/templates/demo/static/site.css +137 -0
- mapproxy/service/templates/demo/static/theme/default/framedCloud.css +0 -0
- mapproxy/service/templates/demo/static/theme/default/google.css +17 -0
- mapproxy/service/templates/demo/static/theme/default/ie6-style.css +10 -0
- mapproxy/service/templates/demo/static/theme/default/style.css +482 -0
- mapproxy/service/templates/demo/static.html +34 -0
- mapproxy/service/templates/demo/tms_demo.html +103 -0
- mapproxy/service/templates/demo/wms_demo.html +140 -0
- mapproxy/service/templates/demo/wmts_demo.html +110 -0
- mapproxy/service/templates/tms_capabilities.xml +13 -0
- mapproxy/service/templates/tms_exception.xml +4 -0
- mapproxy/service/templates/tms_root_resource.xml +7 -0
- mapproxy/service/templates/tms_tilemap_capabilities.xml +14 -0
- mapproxy/service/templates/wms100capabilities.xml +112 -0
- mapproxy/service/templates/wms100exception.xml +4 -0
- mapproxy/service/templates/wms110capabilities.xml +152 -0
- mapproxy/service/templates/wms110exception.xml +5 -0
- mapproxy/service/templates/wms111capabilities.xml +183 -0
- mapproxy/service/templates/wms111exception.xml +5 -0
- mapproxy/service/templates/wms130capabilities.xml +326 -0
- mapproxy/service/templates/wms130exception.xml +8 -0
- mapproxy/service/templates/wmts100capabilities.xml +155 -0
- mapproxy/service/templates/wmts100exception.xml +9 -0
- mapproxy/service/tile.py +536 -0
- mapproxy/service/wms.py +851 -0
- mapproxy/service/wmts.py +381 -0
- mapproxy/source/__init__.py +75 -0
- mapproxy/source/arcgis.py +39 -0
- mapproxy/source/error.py +39 -0
- mapproxy/source/mapnik.py +259 -0
- mapproxy/source/tile.py +96 -0
- mapproxy/source/wms.py +270 -0
- mapproxy/srs.py +726 -0
- mapproxy/template.py +54 -0
- mapproxy/test/__init__.py +0 -0
- mapproxy/test/conftest.py +7 -0
- mapproxy/test/helper.py +247 -0
- mapproxy/test/http.py +494 -0
- mapproxy/test/image.py +210 -0
- mapproxy/test/mocker.py +2268 -0
- mapproxy/test/schemas/inspire/common/1.0/common.xsd +1461 -0
- mapproxy/test/schemas/inspire/common/1.0/enums/enum_bul.xsd +108 -0
- mapproxy/test/schemas/inspire/common/1.0/enums/enum_cze.xsd +108 -0
- mapproxy/test/schemas/inspire/common/1.0/enums/enum_dan.xsd +108 -0
- mapproxy/test/schemas/inspire/common/1.0/enums/enum_dut.xsd +108 -0
- mapproxy/test/schemas/inspire/common/1.0/enums/enum_eng.xsd +155 -0
- mapproxy/test/schemas/inspire/common/1.0/enums/enum_est.xsd +108 -0
- mapproxy/test/schemas/inspire/common/1.0/enums/enum_fin.xsd +108 -0
- mapproxy/test/schemas/inspire/common/1.0/enums/enum_fre.xsd +108 -0
- mapproxy/test/schemas/inspire/common/1.0/enums/enum_ger.xsd +108 -0
- mapproxy/test/schemas/inspire/common/1.0/enums/enum_gle.xsd +109 -0
- mapproxy/test/schemas/inspire/common/1.0/enums/enum_gre.xsd +108 -0
- mapproxy/test/schemas/inspire/common/1.0/enums/enum_hun.xsd +108 -0
- mapproxy/test/schemas/inspire/common/1.0/enums/enum_ita.xsd +108 -0
- mapproxy/test/schemas/inspire/common/1.0/enums/enum_lav.xsd +108 -0
- mapproxy/test/schemas/inspire/common/1.0/enums/enum_lit.xsd +108 -0
- mapproxy/test/schemas/inspire/common/1.0/enums/enum_mlt.xsd +108 -0
- mapproxy/test/schemas/inspire/common/1.0/enums/enum_pol.xsd +108 -0
- mapproxy/test/schemas/inspire/common/1.0/enums/enum_por.xsd +108 -0
- mapproxy/test/schemas/inspire/common/1.0/enums/enum_rum.xsd +108 -0
- mapproxy/test/schemas/inspire/common/1.0/enums/enum_slo.xsd +108 -0
- mapproxy/test/schemas/inspire/common/1.0/enums/enum_slv.xsd +108 -0
- mapproxy/test/schemas/inspire/common/1.0/enums/enum_spa.xsd +108 -0
- mapproxy/test/schemas/inspire/common/1.0/enums/enum_swe.xsd +108 -0
- mapproxy/test/schemas/inspire/common/1.0/network.xsd +521 -0
- mapproxy/test/schemas/inspire/inspire_vs/1.0/inspire_vs.xsd +19 -0
- mapproxy/test/schemas/kml/2.2.0/ReadMe.txt +14 -0
- mapproxy/test/schemas/kml/2.2.0/atom-author-link.xsd +66 -0
- mapproxy/test/schemas/kml/2.2.0/ogckml22.xsd +1646 -0
- mapproxy/test/schemas/kml/2.2.0/xAL.xsd +1680 -0
- mapproxy/test/schemas/ows/1.1.0/ReadMe.txt +87 -0
- mapproxy/test/schemas/ows/1.1.0/ows19115subset.xsd +235 -0
- mapproxy/test/schemas/ows/1.1.0/owsAll.xsd +23 -0
- mapproxy/test/schemas/ows/1.1.0/owsCommon.xsd +157 -0
- mapproxy/test/schemas/ows/1.1.0/owsContents.xsd +86 -0
- mapproxy/test/schemas/ows/1.1.0/owsDataIdentification.xsd +127 -0
- mapproxy/test/schemas/ows/1.1.0/owsDomainType.xsd +279 -0
- mapproxy/test/schemas/ows/1.1.0/owsExceptionReport.xsd +76 -0
- mapproxy/test/schemas/ows/1.1.0/owsGetCapabilities.xsd +112 -0
- mapproxy/test/schemas/ows/1.1.0/owsGetResourceByID.xsd +51 -0
- mapproxy/test/schemas/ows/1.1.0/owsInputOutputData.xsd +59 -0
- mapproxy/test/schemas/ows/1.1.0/owsManifest.xsd +125 -0
- mapproxy/test/schemas/ows/1.1.0/owsOperationsMetadata.xsd +140 -0
- mapproxy/test/schemas/ows/1.1.0/owsServiceIdentification.xsd +60 -0
- mapproxy/test/schemas/ows/1.1.0/owsServiceProvider.xsd +47 -0
- mapproxy/test/schemas/sld/1.1.0/sld_capabilities.xsd +27 -0
- mapproxy/test/schemas/wms/1.0.0/capabilities_1_0_0.dtd +353 -0
- mapproxy/test/schemas/wms/1.0.0/capabilities_1_0_0.xml +188 -0
- mapproxy/test/schemas/wms/1.0.7/capabilities_1_0_7.dtd +524 -0
- mapproxy/test/schemas/wms/1.0.7/capabilities_1_0_7.xml +260 -0
- mapproxy/test/schemas/wms/1.1.0/capabilities_1_1_0.dtd +273 -0
- mapproxy/test/schemas/wms/1.1.0/capabilities_1_1_0.xml +303 -0
- mapproxy/test/schemas/wms/1.1.0/exception_1_1_0.dtd +6 -0
- mapproxy/test/schemas/wms/1.1.0/exception_1_1_0.xml +33 -0
- mapproxy/test/schemas/wms/1.1.1/OGC-exception.xsd +68 -0
- mapproxy/test/schemas/wms/1.1.1/WMS_DescribeLayerResponse.dtd +22 -0
- mapproxy/test/schemas/wms/1.1.1/WMS_MS_Capabilities.dtd +274 -0
- mapproxy/test/schemas/wms/1.1.1/WMS_exception_1_1_1.dtd +5 -0
- mapproxy/test/schemas/wms/1.1.1/capabilities_1_1_1.dtd +276 -0
- mapproxy/test/schemas/wms/1.1.1/capabilities_1_1_1.xml +303 -0
- mapproxy/test/schemas/wms/1.1.1/exception_1_1_1.dtd +6 -0
- mapproxy/test/schemas/wms/1.1.1/exception_1_1_1.xml +33 -0
- mapproxy/test/schemas/wms/1.3.0/ReadMe.txt +8 -0
- mapproxy/test/schemas/wms/1.3.0/capabilities_1_3_0.xml +277 -0
- mapproxy/test/schemas/wms/1.3.0/capabilities_1_3_0.xsd +611 -0
- mapproxy/test/schemas/wms/1.3.0/exceptions_1_3_0.xml +34 -0
- mapproxy/test/schemas/wms/1.3.0/exceptions_1_3_0.xsd +28 -0
- mapproxy/test/schemas/wmsc/1.1.1/OGC-exception.xsd +68 -0
- mapproxy/test/schemas/wmsc/1.1.1/WMS_DescribeLayerResponse.dtd +22 -0
- mapproxy/test/schemas/wmsc/1.1.1/WMS_MS_Capabilities.dtd +283 -0
- mapproxy/test/schemas/wmsc/1.1.1/WMS_exception_1_1_1.dtd +5 -0
- mapproxy/test/schemas/wmsc/1.1.1/capabilities_1_1_1.dtd +276 -0
- mapproxy/test/schemas/wmsc/1.1.1/capabilities_1_1_1.xml +303 -0
- mapproxy/test/schemas/wmsc/1.1.1/exception_1_1_1.dtd +6 -0
- mapproxy/test/schemas/wmsc/1.1.1/exception_1_1_1.xml +33 -0
- mapproxy/test/schemas/wmts/1.0/ReadMe.txt +32 -0
- mapproxy/test/schemas/wmts/1.0/wmts.xsd +28 -0
- mapproxy/test/schemas/wmts/1.0/wmtsAbstract.wsdl +151 -0
- mapproxy/test/schemas/wmts/1.0/wmtsGetCapabilities_request.xsd +38 -0
- mapproxy/test/schemas/wmts/1.0/wmtsGetCapabilities_response.xsd +564 -0
- mapproxy/test/schemas/wmts/1.0/wmtsGetFeatureInfo_request.xsd +57 -0
- mapproxy/test/schemas/wmts/1.0/wmtsGetFeatureInfo_response.xsd +72 -0
- mapproxy/test/schemas/wmts/1.0/wmtsGetTile_request.xsd +91 -0
- mapproxy/test/schemas/wmts/1.0/wmtsKVP.xsd +76 -0
- mapproxy/test/schemas/wmts/1.0/wmtsPayload_response.xsd +70 -0
- mapproxy/test/schemas/xlink/1.0.0/ReadMe.txt +6 -0
- mapproxy/test/schemas/xlink/1.0.0/xlinks.xsd +122 -0
- mapproxy/test/schemas/xml.xsd +287 -0
- mapproxy/test/system/__init__.py +98 -0
- mapproxy/test/system/fixture/arcgis.yaml +57 -0
- mapproxy/test/system/fixture/auth.yaml +70 -0
- mapproxy/test/system/fixture/cache.mbtiles +0 -0
- mapproxy/test/system/fixture/cache_azureblob.yaml +59 -0
- mapproxy/test/system/fixture/cache_band_merge.yaml +73 -0
- mapproxy/test/system/fixture/cache_bulk_meta_tiles.yaml +24 -0
- mapproxy/test/system/fixture/cache_data/dop_cache_EPSG3857/00/000/000/000/000/000/000.png +0 -0
- mapproxy/test/system/fixture/cache_data/wms_cache_EPSG900913/01/000/000/000/000/000/001.jpeg +0 -0
- mapproxy/test/system/fixture/cache_data/wms_cache_transparent_EPSG900913/01/000/000/000/000/000/001.png +0 -0
- mapproxy/test/system/fixture/cache_geopackage.yaml +56 -0
- mapproxy/test/system/fixture/cache_grid_names.yaml +50 -0
- mapproxy/test/system/fixture/cache_mbtiles.yaml +28 -0
- mapproxy/test/system/fixture/cache_s3.yaml +58 -0
- mapproxy/test/system/fixture/cache_source.yaml +81 -0
- mapproxy/test/system/fixture/combined_sources.yaml +130 -0
- mapproxy/test/system/fixture/coverage.yaml +77 -0
- mapproxy/test/system/fixture/demo.yaml +135 -0
- mapproxy/test/system/fixture/dimension.yaml +59 -0
- mapproxy/test/system/fixture/disable_storage.yaml +25 -0
- mapproxy/test/system/fixture/empty_ogrdata.geojson +1 -0
- mapproxy/test/system/fixture/formats.yaml +72 -0
- mapproxy/test/system/fixture/inspire.yaml +101 -0
- mapproxy/test/system/fixture/inspire_full.yaml +124 -0
- mapproxy/test/system/fixture/kml_layer.yaml +66 -0
- mapproxy/test/system/fixture/layer.yaml +260 -0
- mapproxy/test/system/fixture/layergroups.yaml +57 -0
- mapproxy/test/system/fixture/layergroups_root.yaml +106 -0
- mapproxy/test/system/fixture/legendgraphic.yaml +93 -0
- mapproxy/test/system/fixture/mapnik_source.yaml +66 -0
- mapproxy/test/system/fixture/mapproxy_export.yaml +12 -0
- mapproxy/test/system/fixture/mapserver.yaml +23 -0
- mapproxy/test/system/fixture/minimal_cgi.py +16 -0
- mapproxy/test/system/fixture/mixed_mode.yaml +49 -0
- mapproxy/test/system/fixture/multi_cache_layers.yaml +100 -0
- mapproxy/test/system/fixture/multiapp1.yaml +20 -0
- mapproxy/test/system/fixture/multiapp2.yaml +19 -0
- mapproxy/test/system/fixture/renderd_client.yaml +55 -0
- mapproxy/test/system/fixture/scalehints.yaml +70 -0
- mapproxy/test/system/fixture/seed.yaml +94 -0
- mapproxy/test/system/fixture/seed_mapproxy.yaml +39 -0
- mapproxy/test/system/fixture/seed_old.yaml +12 -0
- mapproxy/test/system/fixture/seed_timeouts.yaml +12 -0
- mapproxy/test/system/fixture/seed_timeouts_mapproxy.yaml +27 -0
- mapproxy/test/system/fixture/seedonly.yaml +51 -0
- mapproxy/test/system/fixture/sld.yaml +35 -0
- mapproxy/test/system/fixture/source_errors.yaml +84 -0
- mapproxy/test/system/fixture/source_errors_raise.yaml +82 -0
- mapproxy/test/system/fixture/tileservice_origin.yaml +26 -0
- mapproxy/test/system/fixture/tileservice_refresh.yaml +59 -0
- mapproxy/test/system/fixture/tilesource_minmax_res.yaml +22 -0
- mapproxy/test/system/fixture/util-conf-base-grids.yaml +5 -0
- mapproxy/test/system/fixture/util-conf-overwrite.yaml +13 -0
- mapproxy/test/system/fixture/util-conf-wms-111-cap.xml +90 -0
- mapproxy/test/system/fixture/util_grids.yaml +30 -0
- mapproxy/test/system/fixture/util_wms_capabilities111.xml +130 -0
- mapproxy/test/system/fixture/util_wms_capabilities130.xml +100 -0
- mapproxy/test/system/fixture/util_wms_capabilities_service_exception.xml +5 -0
- mapproxy/test/system/fixture/watermark.yaml +50 -0
- mapproxy/test/system/fixture/wms_srs_extent.yaml +39 -0
- mapproxy/test/system/fixture/wms_versions.yaml +38 -0
- mapproxy/test/system/fixture/wmts.yaml +134 -0
- mapproxy/test/system/fixture/wmts_dimensions.yaml +57 -0
- mapproxy/test/system/fixture/xslt_featureinfo.yaml +54 -0
- mapproxy/test/system/fixture/xslt_featureinfo_input.yaml +51 -0
- mapproxy/test/system/test_arcgis.py +156 -0
- mapproxy/test/system/test_auth.py +1134 -0
- mapproxy/test/system/test_behind_proxy.py +75 -0
- mapproxy/test/system/test_bulk_meta_tiles.py +106 -0
- mapproxy/test/system/test_cache_azureblob.py +127 -0
- mapproxy/test/system/test_cache_band_merge.py +103 -0
- mapproxy/test/system/test_cache_geopackage.py +144 -0
- mapproxy/test/system/test_cache_grid_names.py +89 -0
- mapproxy/test/system/test_cache_mbtiles.py +85 -0
- mapproxy/test/system/test_cache_s3.py +115 -0
- mapproxy/test/system/test_cache_source.py +146 -0
- mapproxy/test/system/test_combined_sources.py +335 -0
- mapproxy/test/system/test_coverage.py +140 -0
- mapproxy/test/system/test_decorate_img.py +214 -0
- mapproxy/test/system/test_demo.py +106 -0
- mapproxy/test/system/test_demo_with_extra_service.py +53 -0
- mapproxy/test/system/test_dimensions.py +278 -0
- mapproxy/test/system/test_disable_storage.py +42 -0
- mapproxy/test/system/test_formats.py +219 -0
- mapproxy/test/system/test_inspire_vs.py +173 -0
- mapproxy/test/system/test_kml.py +262 -0
- mapproxy/test/system/test_layergroups.py +160 -0
- mapproxy/test/system/test_legendgraphic.py +308 -0
- mapproxy/test/system/test_mapnik.py +161 -0
- mapproxy/test/system/test_mapserver.py +81 -0
- mapproxy/test/system/test_mixed_mode_format.py +195 -0
- mapproxy/test/system/test_multi_cache_layers.py +167 -0
- mapproxy/test/system/test_multiapp.py +92 -0
- mapproxy/test/system/test_refresh.py +207 -0
- mapproxy/test/system/test_renderd_client.py +304 -0
- mapproxy/test/system/test_response_headers.py +54 -0
- mapproxy/test/system/test_scalehints.py +140 -0
- mapproxy/test/system/test_seed.py +422 -0
- mapproxy/test/system/test_seed_only.py +93 -0
- mapproxy/test/system/test_sld.py +120 -0
- mapproxy/test/system/test_source_errors.py +377 -0
- mapproxy/test/system/test_tilesource_minmax_res.py +54 -0
- mapproxy/test/system/test_tms.py +276 -0
- mapproxy/test/system/test_tms_origin.py +46 -0
- mapproxy/test/system/test_util_conf.py +304 -0
- mapproxy/test/system/test_util_export.py +210 -0
- mapproxy/test/system/test_util_grids.py +88 -0
- mapproxy/test/system/test_util_wms_capabilities.py +182 -0
- mapproxy/test/system/test_watermark.py +91 -0
- mapproxy/test/system/test_wms.py +1611 -0
- mapproxy/test/system/test_wms_srs_extent.py +165 -0
- mapproxy/test/system/test_wms_version.py +85 -0
- mapproxy/test/system/test_wmsc.py +116 -0
- mapproxy/test/system/test_wmts.py +334 -0
- mapproxy/test/system/test_wmts_dimensions.py +206 -0
- mapproxy/test/system/test_wmts_restful.py +198 -0
- mapproxy/test/system/test_xslt_featureinfo.py +425 -0
- mapproxy/test/test_http_helper.py +219 -0
- mapproxy/test/unit/__init__.py +0 -0
- mapproxy/test/unit/epsg +2 -0
- mapproxy/test/unit/polygons/polygons.dbf +0 -0
- mapproxy/test/unit/polygons/polygons.shp +0 -0
- mapproxy/test/unit/polygons/polygons.shx +0 -0
- mapproxy/test/unit/test_async.py +245 -0
- mapproxy/test/unit/test_auth.py +419 -0
- mapproxy/test/unit/test_cache.py +1193 -0
- mapproxy/test/unit/test_cache_azureblob.py +94 -0
- mapproxy/test/unit/test_cache_compact.py +319 -0
- mapproxy/test/unit/test_cache_couchdb.py +114 -0
- mapproxy/test/unit/test_cache_geopackage.py +221 -0
- mapproxy/test/unit/test_cache_redis.py +67 -0
- mapproxy/test/unit/test_cache_riak.py +76 -0
- mapproxy/test/unit/test_cache_s3.py +84 -0
- mapproxy/test/unit/test_cache_tile.py +427 -0
- mapproxy/test/unit/test_client.py +479 -0
- mapproxy/test/unit/test_client_arcgis.py +73 -0
- mapproxy/test/unit/test_client_cgi.py +136 -0
- mapproxy/test/unit/test_collections.py +116 -0
- mapproxy/test/unit/test_concat_legends.py +37 -0
- mapproxy/test/unit/test_conf_loader.py +1061 -0
- mapproxy/test/unit/test_conf_validator.py +416 -0
- mapproxy/test/unit/test_config.py +117 -0
- mapproxy/test/unit/test_decorate_img.py +185 -0
- mapproxy/test/unit/test_exceptions.py +258 -0
- mapproxy/test/unit/test_featureinfo.py +291 -0
- mapproxy/test/unit/test_file_lock_load.py +49 -0
- mapproxy/test/unit/test_geom.py +503 -0
- mapproxy/test/unit/test_grid.py +1258 -0
- mapproxy/test/unit/test_image.py +1053 -0
- mapproxy/test/unit/test_image_mask.py +181 -0
- mapproxy/test/unit/test_image_messages.py +197 -0
- mapproxy/test/unit/test_image_options.py +160 -0
- mapproxy/test/unit/test_isodate.py +122 -0
- mapproxy/test/unit/test_multiapp.py +163 -0
- mapproxy/test/unit/test_ogr_reader.py +50 -0
- mapproxy/test/unit/test_request.py +745 -0
- mapproxy/test/unit/test_request_wmts.py +178 -0
- mapproxy/test/unit/test_response.py +79 -0
- mapproxy/test/unit/test_seed.py +365 -0
- mapproxy/test/unit/test_seed_cachelock.py +90 -0
- mapproxy/test/unit/test_srs.py +215 -0
- mapproxy/test/unit/test_tiled_source.py +122 -0
- mapproxy/test/unit/test_tilefilter.py +31 -0
- mapproxy/test/unit/test_times.py +25 -0
- mapproxy/test/unit/test_timeutils.py +50 -0
- mapproxy/test/unit/test_util_conf_utils.py +75 -0
- mapproxy/test/unit/test_utils.py +476 -0
- mapproxy/test/unit/test_wms_capabilities.py +44 -0
- mapproxy/test/unit/test_wms_layer.py +113 -0
- mapproxy/test/unit/test_yaml.py +69 -0
- mapproxy/tilefilter.py +59 -0
- mapproxy/util/__init__.py +0 -0
- mapproxy/util/async_.py +227 -0
- mapproxy/util/collections.py +132 -0
- mapproxy/util/coverage.py +329 -0
- mapproxy/util/escape.py +10 -0
- mapproxy/util/ext/__init__.py +14 -0
- mapproxy/util/ext/dictspec/__init__.py +1 -0
- mapproxy/util/ext/dictspec/spec.py +124 -0
- mapproxy/util/ext/dictspec/test/__init__.py +0 -0
- mapproxy/util/ext/dictspec/test/test_validator.py +274 -0
- mapproxy/util/ext/dictspec/validator.py +189 -0
- mapproxy/util/ext/local.py +196 -0
- mapproxy/util/ext/lockfile.py +138 -0
- mapproxy/util/ext/odict.py +330 -0
- mapproxy/util/ext/serving.py +508 -0
- mapproxy/util/ext/tempita/__init__.py +1174 -0
- mapproxy/util/ext/tempita/_looper.py +163 -0
- mapproxy/util/ext/tempita/compat3.py +46 -0
- mapproxy/util/ext/wmsparse/__init__.py +3 -0
- mapproxy/util/ext/wmsparse/duration.py +597 -0
- mapproxy/util/ext/wmsparse/parse.py +305 -0
- mapproxy/util/ext/wmsparse/test/__init__.py +0 -0
- mapproxy/util/ext/wmsparse/test/test_parse.py +162 -0
- mapproxy/util/ext/wmsparse/test/test_util.py +23 -0
- mapproxy/util/ext/wmsparse/test/wms-large-111.xml +2114 -0
- mapproxy/util/ext/wmsparse/test/wms-omniscale-111.xml +90 -0
- mapproxy/util/ext/wmsparse/test/wms-omniscale-130.xml +120 -0
- mapproxy/util/ext/wmsparse/test/wms_nasa_cap.xml +386 -0
- mapproxy/util/ext/wmsparse/util.py +187 -0
- mapproxy/util/fs.py +156 -0
- mapproxy/util/geom.py +295 -0
- mapproxy/util/lib.py +115 -0
- mapproxy/util/lock.py +163 -0
- mapproxy/util/ogr.py +231 -0
- mapproxy/util/py.py +81 -0
- mapproxy/util/times.py +75 -0
- mapproxy/util/yaml.py +56 -0
- mapproxy/version.py +31 -0
- mapproxy/wsgiapp.py +164 -0
- mapproxy-1.16.1.dist-info/METADATA +151 -0
- mapproxy-1.16.1.dist-info/RECORD +458 -0
- mapproxy-1.16.1.dist-info/WHEEL +5 -0
- mapproxy-1.16.1.dist-info/entry_points.txt +3 -0
- mapproxy-1.16.1.dist-info/licenses/AUTHORS.txt +33 -0
- mapproxy-1.16.1.dist-info/licenses/COPYING.txt +60 -0
- mapproxy-1.16.1.dist-info/licenses/LICENSE.txt +202 -0
- mapproxy-1.16.1.dist-info/top_level.txt +1 -0
mapproxy/service/kml.py
ADDED
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
# This file is part of the MapProxy project.
|
|
2
|
+
# Copyright (C) 2010 Omniscale <http://omniscale.de>
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
import re
|
|
17
|
+
|
|
18
|
+
from mapproxy.response import Response
|
|
19
|
+
from mapproxy.exception import RequestError, PlainExceptionHandler
|
|
20
|
+
from mapproxy.service.base import Server
|
|
21
|
+
from mapproxy.request.tile import TileRequest
|
|
22
|
+
from mapproxy.srs import SRS
|
|
23
|
+
from mapproxy.util.coverage import load_limited_to
|
|
24
|
+
from mapproxy.util.escape import escape_html
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class KMLRequest(TileRequest):
|
|
28
|
+
"""
|
|
29
|
+
Class for TMS-like KML requests.
|
|
30
|
+
"""
|
|
31
|
+
request_handler_name = 'map'
|
|
32
|
+
req_prefix = '/kml'
|
|
33
|
+
tile_req_re = re.compile(r'''^(?P<begin>/kml)/
|
|
34
|
+
(?P<layer>[^/]+)/
|
|
35
|
+
((?P<layer_spec>[^/]+)/)?
|
|
36
|
+
(?P<z>-?\d+)/
|
|
37
|
+
(?P<x>-?\d+)/
|
|
38
|
+
(?P<y>-?\d+)\.(?P<format>\w+)''', re.VERBOSE)
|
|
39
|
+
|
|
40
|
+
def __init__(self, request):
|
|
41
|
+
TileRequest.__init__(self, request)
|
|
42
|
+
if self.format == 'kml':
|
|
43
|
+
self.request_handler_name = 'kml'
|
|
44
|
+
|
|
45
|
+
@property
|
|
46
|
+
def exception_handler(self):
|
|
47
|
+
return PlainExceptionHandler()
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class KMLInitRequest(TileRequest):
|
|
51
|
+
"""
|
|
52
|
+
Class for TMS-like KML requests.
|
|
53
|
+
"""
|
|
54
|
+
request_handler_name = 'map'
|
|
55
|
+
req_prefix = '/kml'
|
|
56
|
+
tile_req_re = re.compile(r'''^(?P<begin>/kml)/
|
|
57
|
+
(?P<layer>[^/]+)
|
|
58
|
+
(/(?P<layer_spec>[^/]+))?
|
|
59
|
+
/?$
|
|
60
|
+
''', re.VERBOSE)
|
|
61
|
+
|
|
62
|
+
def __init__(self, request):
|
|
63
|
+
self.http = request
|
|
64
|
+
self.tile = (0, 0, 0)
|
|
65
|
+
self.format = 'kml'
|
|
66
|
+
self.request_handler_name = 'kml'
|
|
67
|
+
self._init_request()
|
|
68
|
+
|
|
69
|
+
@property
|
|
70
|
+
def exception_handler(self):
|
|
71
|
+
return PlainExceptionHandler()
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def kml_request(req):
|
|
75
|
+
if KMLInitRequest.tile_req_re.match(req.path):
|
|
76
|
+
return KMLInitRequest(req)
|
|
77
|
+
else:
|
|
78
|
+
return KMLRequest(req)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class KMLServer(Server):
|
|
82
|
+
"""
|
|
83
|
+
OGC KML 2.2 Server
|
|
84
|
+
"""
|
|
85
|
+
names = ('kml',)
|
|
86
|
+
request_parser = staticmethod(kml_request)
|
|
87
|
+
request_methods = ('map', 'kml')
|
|
88
|
+
|
|
89
|
+
def __init__(self, layers, md, max_tile_age=None, use_dimension_layers=False):
|
|
90
|
+
Server.__init__(self)
|
|
91
|
+
self.layers = layers
|
|
92
|
+
self.md = md
|
|
93
|
+
self.max_tile_age = max_tile_age
|
|
94
|
+
self.use_dimension_layers = use_dimension_layers
|
|
95
|
+
|
|
96
|
+
def map(self, map_request):
|
|
97
|
+
"""
|
|
98
|
+
:return: the requested tile
|
|
99
|
+
"""
|
|
100
|
+
# force 'sw' origin for kml
|
|
101
|
+
map_request.origin = 'sw'
|
|
102
|
+
layer = self.layer(map_request)
|
|
103
|
+
limit_to = self.authorize_tile_layer(layer, map_request)
|
|
104
|
+
tile = layer.render(map_request, coverage=limit_to)
|
|
105
|
+
tile_format = getattr(tile, 'format', map_request.format)
|
|
106
|
+
resp = Response(tile.as_buffer(),
|
|
107
|
+
content_type='image/' + tile_format)
|
|
108
|
+
resp.cache_headers(tile.timestamp, etag_data=(tile.timestamp, tile.size),
|
|
109
|
+
max_age=self.max_tile_age)
|
|
110
|
+
resp.make_conditional(map_request.http)
|
|
111
|
+
return resp
|
|
112
|
+
|
|
113
|
+
def authorize_tile_layer(self, tile_layer, request):
|
|
114
|
+
if 'mapproxy.authorize' in request.http.environ:
|
|
115
|
+
if request.tile:
|
|
116
|
+
query_extent = (tile_layer.grid.srs.srs_code,
|
|
117
|
+
tile_layer.tile_bbox(request, use_profiles=request.use_profiles))
|
|
118
|
+
else:
|
|
119
|
+
query_extent = None # for layer capabilities
|
|
120
|
+
result = request.http.environ['mapproxy.authorize']('kml', [tile_layer.name],
|
|
121
|
+
query_extent=query_extent, environ=request.http.environ)
|
|
122
|
+
if result['authorized'] == 'unauthenticated':
|
|
123
|
+
raise RequestError('unauthorized', status=401)
|
|
124
|
+
if result['authorized'] == 'full':
|
|
125
|
+
return
|
|
126
|
+
if result['authorized'] == 'partial':
|
|
127
|
+
if result['layers'].get(tile_layer.name, {}).get('tile', False) == True:
|
|
128
|
+
limited_to = result['layers'][tile_layer.name].get('limited_to')
|
|
129
|
+
if not limited_to:
|
|
130
|
+
limited_to = result.get('limited_to')
|
|
131
|
+
if limited_to:
|
|
132
|
+
return load_limited_to(limited_to)
|
|
133
|
+
else:
|
|
134
|
+
return None
|
|
135
|
+
raise RequestError('forbidden', status=403)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def _internal_layer(self, tile_request):
|
|
139
|
+
if '_layer_spec' in tile_request.dimensions:
|
|
140
|
+
name = tile_request.layer + '_' + tile_request.dimensions['_layer_spec']
|
|
141
|
+
else:
|
|
142
|
+
name = tile_request.layer
|
|
143
|
+
if name in self.layers:
|
|
144
|
+
return self.layers[name]
|
|
145
|
+
if name + '_EPSG4326' in self.layers:
|
|
146
|
+
return self.layers[name + '_EPSG4326']
|
|
147
|
+
if name + '_EPSG900913' in self.layers:
|
|
148
|
+
return self.layers[name + '_EPSG900913']
|
|
149
|
+
return None
|
|
150
|
+
|
|
151
|
+
def _internal_dimension_layer(self, tile_request):
|
|
152
|
+
key = (tile_request.layer, tile_request.dimensions.get('_layer_spec'))
|
|
153
|
+
return self.layers.get(key)
|
|
154
|
+
|
|
155
|
+
def layer(self, tile_request):
|
|
156
|
+
if self.use_dimension_layers:
|
|
157
|
+
internal_layer = self._internal_dimension_layer(tile_request)
|
|
158
|
+
else:
|
|
159
|
+
internal_layer = self._internal_layer(tile_request)
|
|
160
|
+
if internal_layer is None:
|
|
161
|
+
raise RequestError('unknown layer: ' + tile_request.layer, request=tile_request)
|
|
162
|
+
return internal_layer
|
|
163
|
+
|
|
164
|
+
def kml(self, map_request):
|
|
165
|
+
"""
|
|
166
|
+
:return: the rendered KML response
|
|
167
|
+
"""
|
|
168
|
+
# force 'sw' origin for kml
|
|
169
|
+
map_request.origin = 'sw'
|
|
170
|
+
layer = self.layer(map_request)
|
|
171
|
+
self.authorize_tile_layer(layer, map_request)
|
|
172
|
+
|
|
173
|
+
tile_coord = map_request.tile
|
|
174
|
+
|
|
175
|
+
initial_level = False
|
|
176
|
+
if tile_coord[2] == 0:
|
|
177
|
+
initial_level = True
|
|
178
|
+
|
|
179
|
+
bbox = self._tile_wgs_bbox(map_request, layer, limit=True)
|
|
180
|
+
if bbox is None:
|
|
181
|
+
raise RequestError('The requested tile is outside the bounding box '
|
|
182
|
+
'of the tile map.', request=map_request)
|
|
183
|
+
tile = SubTile(tile_coord, bbox)
|
|
184
|
+
|
|
185
|
+
subtiles = self._get_subtiles(map_request, layer)
|
|
186
|
+
tile_size = layer.grid.tile_size[0]
|
|
187
|
+
url = escape_html(map_request.http.script_url.rstrip('/'))
|
|
188
|
+
result = KMLRenderer().render(
|
|
189
|
+
tile=tile, subtiles=subtiles, layer=layer, url=url, name=map_request.layer, format=layer.format,
|
|
190
|
+
name_path=layer.md['name_path'], initial_level=initial_level, tile_size=tile_size)
|
|
191
|
+
resp = Response(result, content_type='application/vnd.google-earth.kml+xml')
|
|
192
|
+
resp.cache_headers(etag_data=(result,), max_age=self.max_tile_age)
|
|
193
|
+
resp.make_conditional(map_request.http)
|
|
194
|
+
return resp
|
|
195
|
+
|
|
196
|
+
def _get_subtiles(self, tile_request, layer):
|
|
197
|
+
"""
|
|
198
|
+
Create four `SubTile` for the next level of `tile`.
|
|
199
|
+
"""
|
|
200
|
+
tile = tile_request.tile
|
|
201
|
+
bbox = layer.tile_bbox(tile_request, use_profiles=tile_request.use_profiles, limit=True)
|
|
202
|
+
|
|
203
|
+
level = layer.grid.internal_tile_coord((tile[0], tile[1], tile[2]+1), use_profiles=False)[2]
|
|
204
|
+
bbox_, tile_grid_, tiles = layer.grid.get_affected_level_tiles(bbox, level)
|
|
205
|
+
subtiles = []
|
|
206
|
+
for coord in tiles:
|
|
207
|
+
if coord is None: continue
|
|
208
|
+
sub_bbox = layer.grid.tile_bbox(coord)
|
|
209
|
+
if sub_bbox is not None:
|
|
210
|
+
# only add subtiles where the lower left corner is in the bbox
|
|
211
|
+
# to prevent subtiles to appear in multiple KML docs
|
|
212
|
+
DELTA = -1.0/10e6
|
|
213
|
+
if (sub_bbox[0] - bbox[0]) > DELTA and (sub_bbox[1] - bbox[1]) > DELTA:
|
|
214
|
+
sub_bbox_wgs = self._tile_bbox_to_wgs(sub_bbox, layer.grid)
|
|
215
|
+
coord = layer.grid.external_tile_coord(coord, use_profiles=False)
|
|
216
|
+
if layer.grid.origin not in ('ll', 'sw', None):
|
|
217
|
+
coord = layer.grid.flip_tile_coord(coord)
|
|
218
|
+
subtiles.append(SubTile(coord, sub_bbox_wgs))
|
|
219
|
+
|
|
220
|
+
return subtiles
|
|
221
|
+
|
|
222
|
+
def _tile_wgs_bbox(self, tile_request, layer, limit=False):
|
|
223
|
+
bbox = layer.tile_bbox(tile_request, use_profiles=tile_request.use_profiles,
|
|
224
|
+
limit=limit)
|
|
225
|
+
if bbox is None:
|
|
226
|
+
return None
|
|
227
|
+
return self._tile_bbox_to_wgs(bbox, layer.grid)
|
|
228
|
+
|
|
229
|
+
def _tile_bbox_to_wgs(self, src_bbox, grid):
|
|
230
|
+
bbox = grid.srs.transform_bbox_to(SRS(4326), src_bbox, with_points=4)
|
|
231
|
+
if grid.srs == SRS(900913):
|
|
232
|
+
bbox = list(bbox)
|
|
233
|
+
if abs(src_bbox[1] - -20037508.342789244) < 0.1:
|
|
234
|
+
bbox[1] = -90.0
|
|
235
|
+
if abs(src_bbox[3] - 20037508.342789244) < 0.1:
|
|
236
|
+
bbox[3] = 90.0
|
|
237
|
+
return bbox
|
|
238
|
+
|
|
239
|
+
def check_map_request(self, map_request):
|
|
240
|
+
if map_request.layer not in self.layers:
|
|
241
|
+
raise RequestError('unknown layer: ' + map_request.layer, request=map_request)
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
class SubTile(object):
|
|
245
|
+
"""
|
|
246
|
+
Contains the ``bbox`` and ``coord`` of a sub tile.
|
|
247
|
+
"""
|
|
248
|
+
def __init__(self, coord, bbox):
|
|
249
|
+
self.coord = coord
|
|
250
|
+
self.bbox = bbox
|
|
251
|
+
|
|
252
|
+
class KMLRenderer(object):
|
|
253
|
+
header = """<?xml version="1.0"?>
|
|
254
|
+
<kml xmlns="http://www.opengis.net/kml/2.2">
|
|
255
|
+
<Document>
|
|
256
|
+
<name>%(layer_name)s</name>
|
|
257
|
+
<Region>
|
|
258
|
+
<LatLonAltBox>
|
|
259
|
+
<north>%(north)f</north><south>%(south)f</south>
|
|
260
|
+
<east>%(east)f</east><west>%(west)f</west>
|
|
261
|
+
</LatLonAltBox>
|
|
262
|
+
</Region>
|
|
263
|
+
"""
|
|
264
|
+
|
|
265
|
+
network_link = """<NetworkLink>
|
|
266
|
+
<name>%(layer_name)s - %(coord)s</name>
|
|
267
|
+
<Region>
|
|
268
|
+
<LatLonAltBox>
|
|
269
|
+
<north>%(north)f</north><south>%(south)f</south>
|
|
270
|
+
<east>%(east)f</east><west>%(west)f</west>
|
|
271
|
+
</LatLonAltBox>
|
|
272
|
+
<Lod>
|
|
273
|
+
<minLodPixels>%(min_lod)d</minLodPixels>
|
|
274
|
+
<maxLodPixels>-1</maxLodPixels>
|
|
275
|
+
</Lod>
|
|
276
|
+
</Region>
|
|
277
|
+
<Link>
|
|
278
|
+
<href>%(href)s</href>
|
|
279
|
+
<viewRefreshMode>onRegion</viewRefreshMode>
|
|
280
|
+
<viewFormat/>
|
|
281
|
+
</Link>
|
|
282
|
+
</NetworkLink>
|
|
283
|
+
"""
|
|
284
|
+
ground_overlay = """<GroundOverlay>
|
|
285
|
+
<name>%(coord)s</name>
|
|
286
|
+
<Region>
|
|
287
|
+
<LatLonAltBox>
|
|
288
|
+
<north>%(north)f</north><south>%(south)f</south>
|
|
289
|
+
<east>%(east)f</east><west>%(west)f</west>
|
|
290
|
+
</LatLonAltBox>
|
|
291
|
+
<Lod>
|
|
292
|
+
<minLodPixels>%(min_lod)d</minLodPixels>
|
|
293
|
+
<maxLodPixels>%(max_lod)d</maxLodPixels>
|
|
294
|
+
<minFadeExtent>8</minFadeExtent>
|
|
295
|
+
<maxFadeExtent>8</maxFadeExtent>
|
|
296
|
+
</Lod>
|
|
297
|
+
</Region>
|
|
298
|
+
<drawOrder>%(level)d</drawOrder>
|
|
299
|
+
<Icon>
|
|
300
|
+
<href>%(href)s</href>
|
|
301
|
+
</Icon>
|
|
302
|
+
<LatLonBox>
|
|
303
|
+
<north>%(north)f</north><south>%(south)f</south>
|
|
304
|
+
<east>%(east)f</east><west>%(west)f</west>
|
|
305
|
+
</LatLonBox>
|
|
306
|
+
</GroundOverlay>
|
|
307
|
+
"""
|
|
308
|
+
footer = """</Document>
|
|
309
|
+
</kml>
|
|
310
|
+
"""
|
|
311
|
+
def render(self, tile, subtiles, layer, url, name, name_path, format, initial_level, tile_size):
|
|
312
|
+
response = []
|
|
313
|
+
response.append(self.header % dict(east=tile.bbox[2], south=tile.bbox[1],
|
|
314
|
+
west=tile.bbox[0], north=tile.bbox[3], layer_name=name))
|
|
315
|
+
|
|
316
|
+
name_path = '/'.join(name_path)
|
|
317
|
+
for subtile in subtiles:
|
|
318
|
+
kml_href = '%s/kml/%s/%d/%d/%d.kml' % (url, name_path,
|
|
319
|
+
subtile.coord[2], subtile.coord[0], subtile.coord[1])
|
|
320
|
+
response.append(self.network_link % dict(east=subtile.bbox[2], south=subtile.bbox[1],
|
|
321
|
+
west=subtile.bbox[0], north=subtile.bbox[3], min_lod=tile_size/2, href=kml_href,
|
|
322
|
+
layer_name=name, coord=subtile.coord))
|
|
323
|
+
|
|
324
|
+
for subtile in subtiles:
|
|
325
|
+
tile_href = '%s/kml/%s/%d/%d/%d.%s' % ( url, name_path,
|
|
326
|
+
subtile.coord[2], subtile.coord[0], subtile.coord[1], layer.format)
|
|
327
|
+
response.append(self.ground_overlay % dict(east=subtile.bbox[2], south=subtile.bbox[1],
|
|
328
|
+
west=subtile.bbox[0], north=subtile.bbox[3], coord=subtile.coord,
|
|
329
|
+
min_lod=tile_size/2, max_lod=tile_size*3, href=tile_href, level=subtile.coord[2]))
|
|
330
|
+
response.append(self.footer)
|
|
331
|
+
return ''.join(response)
|
mapproxy/service/ows.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# This file is part of the MapProxy project.
|
|
2
|
+
# Copyright (C) 2011 Omniscale <http://omniscale.de>
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
"""
|
|
17
|
+
Wrapper service handler for all OWS services (/service?).
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
class OWSServer(object):
|
|
21
|
+
"""
|
|
22
|
+
Wraps all OWS services (/service?, /ows?, /wms?, /wmts?) and dispatches requests
|
|
23
|
+
based on the ``services`` query argument.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
def __init__(self, services):
|
|
27
|
+
self.names = ['service', 'ows']
|
|
28
|
+
self.services = {}
|
|
29
|
+
for service in services:
|
|
30
|
+
if service.service == 'wms' and 'wms' not in self.names:
|
|
31
|
+
self.names.append('wms')
|
|
32
|
+
self.services[service.service] = service
|
|
33
|
+
|
|
34
|
+
def handle(self, req):
|
|
35
|
+
service = req.args.get('service', 'wms').lower()
|
|
36
|
+
assert service in self.services
|
|
37
|
+
|
|
38
|
+
return self.services[service].handle(req)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# This file is part of the MapProxy project.
|
|
2
|
+
# Copyright (C) 2010 Omniscale <http://omniscale.de>
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
from mapproxy.template import bunch
|
|
17
|
+
from mapproxy.compat.modules import escape
|
|
18
|
+
|
|
19
|
+
__all__ = ['escape', 'indent', 'bunch', 'wms100format', 'wms100info_format',
|
|
20
|
+
'wms111metadatatype']
|
|
21
|
+
|
|
22
|
+
def indent(text, n=2):
|
|
23
|
+
return '\n'.join(' '*n + line for line in text.split('\n'))
|
|
24
|
+
|
|
25
|
+
def wms100format(format):
|
|
26
|
+
"""
|
|
27
|
+
>>> wms100format('image/png')
|
|
28
|
+
'PNG'
|
|
29
|
+
>>> wms100format('image/GeoTIFF')
|
|
30
|
+
"""
|
|
31
|
+
_mime_class, sub_type = format.split('/')
|
|
32
|
+
sub_type = sub_type.upper()
|
|
33
|
+
if sub_type in ['PNG', 'TIFF', 'GIF', 'JPEG']:
|
|
34
|
+
return sub_type
|
|
35
|
+
else:
|
|
36
|
+
return None
|
|
37
|
+
|
|
38
|
+
def wms100info_format(format):
|
|
39
|
+
"""
|
|
40
|
+
>>> wms100info_format('text/html')
|
|
41
|
+
'MIME'
|
|
42
|
+
>>> wms100info_format('application/vnd.ogc.gml')
|
|
43
|
+
'GML.1'
|
|
44
|
+
"""
|
|
45
|
+
if format in ('application/vnd.ogc.gml', 'text/xml'):
|
|
46
|
+
return 'GML.1'
|
|
47
|
+
return 'MIME'
|
|
48
|
+
|
|
49
|
+
def wms111metadatatype(type):
|
|
50
|
+
if type == 'ISO19115:2003':
|
|
51
|
+
return 'TC211'
|
|
52
|
+
if type == 'FGDC:1998':
|
|
53
|
+
return 'FGDC'
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{{py:
|
|
2
|
+
from mapproxy.compat.modules import escape
|
|
3
|
+
import textwrap
|
|
4
|
+
|
|
5
|
+
wrapper = textwrap.TextWrapper(replace_whitespace=False, width=90,
|
|
6
|
+
break_long_words=False)
|
|
7
|
+
menu_title = "Capabilities"
|
|
8
|
+
jscript_openlayers = None
|
|
9
|
+
jscript_functions = None
|
|
10
|
+
}}
|
|
11
|
+
<h2>{{service}} GetCapabilities</h2>
|
|
12
|
+
<a href="{{url}}">{{url}}</a>
|
|
13
|
+
<pre>
|
|
14
|
+
{{capabilities}}
|
|
15
|
+
</pre>
|
|
16
|
+
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
{{py:
|
|
2
|
+
|
|
3
|
+
from mapproxy.compat import PY2
|
|
4
|
+
|
|
5
|
+
if PY2:
|
|
6
|
+
from urllib import quote, quote_plus
|
|
7
|
+
else:
|
|
8
|
+
from urllib.parse import quote, quote_plus
|
|
9
|
+
from mapproxy.version import version
|
|
10
|
+
|
|
11
|
+
def strip(s):
|
|
12
|
+
return s.split('/')[1]
|
|
13
|
+
|
|
14
|
+
def replace(s):
|
|
15
|
+
return s.replace(':','')
|
|
16
|
+
|
|
17
|
+
menu_title=None
|
|
18
|
+
jscript_openlayers=None
|
|
19
|
+
}}
|
|
20
|
+
{{def jscript_functions}}
|
|
21
|
+
<script type="text/javascript">
|
|
22
|
+
/**
|
|
23
|
+
* Getting the closest parent with the given tag name.
|
|
24
|
+
*/
|
|
25
|
+
function NeighborFormSubmit(obj)
|
|
26
|
+
{
|
|
27
|
+
var obj_parent = obj.parentNode;
|
|
28
|
+
if (!obj_parent) return false;
|
|
29
|
+
if (obj_parent.tagName.toLowerCase() != 'tr') return NeighborFormSubmit(obj_parent);
|
|
30
|
+
var forms = obj_parent.getElementsByTagName('form');
|
|
31
|
+
if (!forms) return false;
|
|
32
|
+
forms[0].submit()
|
|
33
|
+
}
|
|
34
|
+
</script>
|
|
35
|
+
{{enddef}}
|
|
36
|
+
<h2>About</h2>
|
|
37
|
+
<p>MapProxy Version {{version}}</p>
|
|
38
|
+
{{ extra_services_html_beginning }}
|
|
39
|
+
<h2>WMS</h2>
|
|
40
|
+
{{if 'wms' in services}}
|
|
41
|
+
<div class="capabilities">
|
|
42
|
+
<span>Capabilities document</span>
|
|
43
|
+
<span><a href="../service?REQUEST=GetCapabilities">(download as xml)</a></span>
|
|
44
|
+
<span><a href="../demo/?wms_capabilities">(view as html)</a></span>
|
|
45
|
+
</div>
|
|
46
|
+
{{if 'wms_111' in services }}
|
|
47
|
+
<table class="code">
|
|
48
|
+
<tr>
|
|
49
|
+
<th>Layer</th>
|
|
50
|
+
<th>Coordinate-System</th>
|
|
51
|
+
<th>Image-Format</th>
|
|
52
|
+
</tr>
|
|
53
|
+
{{for layer in layers.values()}}
|
|
54
|
+
<tr>
|
|
55
|
+
<td rowspan="{{len(formats)}}">{{layer.name}}</td>
|
|
56
|
+
{{for loop, format in looper(formats)}}
|
|
57
|
+
<td class="value epsg-codes">
|
|
58
|
+
<form action="" method="GET">
|
|
59
|
+
<select name="srs" onchange="this.form.submit()">
|
|
60
|
+
{{for srs_name, srs_code in layer_srs(layer)}}
|
|
61
|
+
<option value="{{srs_code}}">{{srs_name}}</option>
|
|
62
|
+
{{endfor}}
|
|
63
|
+
</select>
|
|
64
|
+
<input type="hidden" name="format" value="{{format}}">
|
|
65
|
+
<input type="hidden" name="wms_layer" value="{{layer.name}}">
|
|
66
|
+
</form>
|
|
67
|
+
</td>
|
|
68
|
+
<td class="value">
|
|
69
|
+
<a href="#" onclick="NeighborFormSubmit(this)">{{format | strip}}</a>
|
|
70
|
+
</td>
|
|
71
|
+
</tr>
|
|
72
|
+
{{endfor}}
|
|
73
|
+
{{endfor}}
|
|
74
|
+
</table>
|
|
75
|
+
<p>Coordinate systems marked with * are supported without reprojection.</p>
|
|
76
|
+
{{else}}
|
|
77
|
+
<div class="capabilities">
|
|
78
|
+
<span>The demo service only supports WMS 1.1.1. Enable 1.1.1 to see a list of your configured layers.</span>
|
|
79
|
+
</div>
|
|
80
|
+
{{endif}}
|
|
81
|
+
{{else}}
|
|
82
|
+
<div class="capabilities">
|
|
83
|
+
<span>This service is not available with the current configuration.</span>
|
|
84
|
+
</div>
|
|
85
|
+
{{endif}}
|
|
86
|
+
<h2>WMS-C</h2>
|
|
87
|
+
{{if 'wms' in services}}
|
|
88
|
+
<div class="capabilities">
|
|
89
|
+
<span>Capabilities document</span>
|
|
90
|
+
<span><a href="../service?REQUEST=GetCapabilities&tiled=true">(download as xml)</a></span>
|
|
91
|
+
<span><a href="../demo/?wmsc_capabilities">(view as html)</a></span>
|
|
92
|
+
</div>
|
|
93
|
+
{{else}}
|
|
94
|
+
<div class="capabilities">
|
|
95
|
+
<span>This service is not available with the current configuration.</span>
|
|
96
|
+
</div>
|
|
97
|
+
{{endif}}
|
|
98
|
+
<h2>WMTS</h2>
|
|
99
|
+
{{if 'wmts' in services}}
|
|
100
|
+
{{if 'wmts_kvp' in services}}
|
|
101
|
+
<div class="capabilities">
|
|
102
|
+
<span>KVP capabilities document</span>
|
|
103
|
+
<span><a href="../service?REQUEST=GetCapabilities&SERVICE=WMTS">(download as xml)</a></span>
|
|
104
|
+
<span><a href="../demo/?wmts_capabilities_kvp">(view as html)</a></span>
|
|
105
|
+
</div>
|
|
106
|
+
{{endif}}
|
|
107
|
+
{{if 'wmts_restful' in services}}
|
|
108
|
+
<div class="capabilities">
|
|
109
|
+
<span>RESTFul capabilities document</span>
|
|
110
|
+
<span><a href="../wmts/1.0.0/WMTSCapabilities.xml">(download as xml)</a></span>
|
|
111
|
+
<span><a href="../demo/?wmts_capabilities">(view as html)</a></span>
|
|
112
|
+
</div>
|
|
113
|
+
{{endif}}
|
|
114
|
+
<table class="code">
|
|
115
|
+
<tr>
|
|
116
|
+
<th>Layer</th>
|
|
117
|
+
<th>Coordinate-System</th>
|
|
118
|
+
<th>Image-Format</th>
|
|
119
|
+
</tr>
|
|
120
|
+
{{for wmts_layer_name, wmts_layers in wmts_layers.items()}}
|
|
121
|
+
<tr><td rowspan="{{len(wmts_layers)}}">{{wmts_layer_name}}</td>
|
|
122
|
+
{{for loop, layer in looper(wmts_layers)}}
|
|
123
|
+
{{if not loop.first}}
|
|
124
|
+
<tr>
|
|
125
|
+
{{endif}}
|
|
126
|
+
{{if layer.grid.supports_access_with_origin('nw')}}
|
|
127
|
+
<td class="value"><a href="../demo/?wmts_layer={{layer.name}}&format={{layer.format}}&srs={{layer.grid.srs.srs_code | quote}}">{{layer.grid.srs.srs_code}}</a></td>
|
|
128
|
+
<td class="value"><a href="../demo/?wmts_layer={{layer.name}}&format={{layer.format}}&srs={{layer.grid.srs.srs_code | quote}}">{{layer.format}}</a>
|
|
129
|
+
{{else}}
|
|
130
|
+
<td class="value" colspan="2">
|
|
131
|
+
{{layer.grid.name}} not compatible with WMTS
|
|
132
|
+
</td>
|
|
133
|
+
{{endif}}
|
|
134
|
+
</tr>
|
|
135
|
+
{{endfor}}
|
|
136
|
+
{{endfor}}
|
|
137
|
+
</table>
|
|
138
|
+
{{else}}
|
|
139
|
+
<div class="capabilities">
|
|
140
|
+
<span>This service is not available with the current configuration.</span>
|
|
141
|
+
</div>
|
|
142
|
+
{{endif}}
|
|
143
|
+
<h2>TMS</h2>
|
|
144
|
+
{{if 'tms' in services}}
|
|
145
|
+
<div class="capabilities">
|
|
146
|
+
<span>Capabilities document</span>
|
|
147
|
+
<span><a href="../tms/1.0.0/">(download as xml)</a></span>
|
|
148
|
+
<span><a href="../demo/?tms_capabilities">(view as html)</a></span>
|
|
149
|
+
</div>
|
|
150
|
+
<table class="code">
|
|
151
|
+
<tr>
|
|
152
|
+
<th>Layer</th>
|
|
153
|
+
<th>Coordinate-System</th>
|
|
154
|
+
<th>Image-Format</th>
|
|
155
|
+
<th>Layer Capabilities</th>
|
|
156
|
+
</tr>
|
|
157
|
+
{{for tms_layer_name, tms_layers in tms_layers.items()}}
|
|
158
|
+
<tr><td rowspan="{{len(tms_layers)}}">{{tms_layer_name}}</td>
|
|
159
|
+
{{for loop, layer in looper(tms_layers)}}
|
|
160
|
+
{{if not loop.first}}
|
|
161
|
+
<tr>
|
|
162
|
+
{{endif}}
|
|
163
|
+
{{if layer.grid.supports_access_with_origin('sw')}}
|
|
164
|
+
<td class="value"><a href="../demo/?tms_layer={{layer.name}}&format={{layer.format}}&srs={{layer.grid.srs.srs_code | quote}}">{{layer.grid.srs.srs_code}}</a></td>
|
|
165
|
+
<td class="value"><a href="../demo/?tms_layer={{layer.name}}&format={{layer.format}}&srs={{layer.grid.srs.srs_code | quote}}">{{layer.format}}</a></td>
|
|
166
|
+
<td class="value"><a href="../demo/?tms_capabilities&layer={{layer.name}}&srs={{layer.md['name_path'][1]}}">click here</a></td>
|
|
167
|
+
{{else}}
|
|
168
|
+
<td class="value" colspan="3">
|
|
169
|
+
{{layer.grid.name}} not compatible with TMS
|
|
170
|
+
</td>
|
|
171
|
+
{{endif}}
|
|
172
|
+
</tr>
|
|
173
|
+
{{endfor}}
|
|
174
|
+
{{endfor}}
|
|
175
|
+
</table>
|
|
176
|
+
{{else}}
|
|
177
|
+
<div class="capabilities">
|
|
178
|
+
<span>This service is not available with the current configuration.</span>
|
|
179
|
+
</div>
|
|
180
|
+
{{endif}}
|
|
181
|
+
{{ extra_services_html_end }}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
[first]
|
|
2
|
+
|
|
3
|
+
[last]
|
|
4
|
+
|
|
5
|
+
[include]
|
|
6
|
+
OpenLayers/Control.js
|
|
7
|
+
OpenLayers/Map.js
|
|
8
|
+
OpenLayers/Control/Attribution.js
|
|
9
|
+
OpenLayers/Control/Navigation.js
|
|
10
|
+
OpenLayers/Control/PanZoom.js
|
|
11
|
+
OpenLayers/Projection.js
|
|
12
|
+
OpenLayers/Layer/WMS.js
|
|
13
|
+
OpenLayers/Layer/TMS.js
|
|
14
|
+
OpenLayers/Layer/WMTS.js
|
|
15
|
+
|
|
16
|
+
[exclude]
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|