MapProxy 2.1.0__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-2.1.0.dist-info/AUTHORS.txt +33 -0
- MapProxy-2.1.0.dist-info/COPYING.txt +60 -0
- MapProxy-2.1.0.dist-info/LICENSE.txt +202 -0
- MapProxy-2.1.0.dist-info/METADATA +165 -0
- MapProxy-2.1.0.dist-info/RECORD +459 -0
- MapProxy-2.1.0.dist-info/WHEEL +5 -0
- MapProxy-2.1.0.dist-info/entry_points.txt +4 -0
- MapProxy-2.1.0.dist-info/top_level.txt +1 -0
- mapproxy/__init__.py +0 -0
- mapproxy/cache/__init__.py +36 -0
- mapproxy/cache/azureblob.py +145 -0
- mapproxy/cache/base.py +120 -0
- mapproxy/cache/compact.py +665 -0
- mapproxy/cache/couchdb.py +301 -0
- mapproxy/cache/dummy.py +36 -0
- mapproxy/cache/file.py +200 -0
- mapproxy/cache/geopackage.py +647 -0
- mapproxy/cache/legend.py +87 -0
- mapproxy/cache/mbtiles.py +411 -0
- mapproxy/cache/meta.py +80 -0
- mapproxy/cache/path.py +261 -0
- mapproxy/cache/redis.py +152 -0
- mapproxy/cache/renderd.py +100 -0
- mapproxy/cache/riak.py +206 -0
- mapproxy/cache/s3.py +209 -0
- mapproxy/cache/tile.py +736 -0
- mapproxy/client/__init__.py +0 -0
- mapproxy/client/arcgis.py +82 -0
- mapproxy/client/cgi.py +141 -0
- mapproxy/client/http.py +295 -0
- mapproxy/client/log.py +33 -0
- mapproxy/client/tile.py +158 -0
- mapproxy/client/wms.py +255 -0
- mapproxy/compat/__init__.py +0 -0
- mapproxy/compat/image.py +86 -0
- mapproxy/config/__init__.py +22 -0
- mapproxy/config/config-schema.json +813 -0
- mapproxy/config/config.py +213 -0
- mapproxy/config/coverage.py +108 -0
- mapproxy/config/defaults.py +102 -0
- mapproxy/config/loader.py +2399 -0
- mapproxy/config/spec.py +657 -0
- mapproxy/config/validator.py +242 -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 +598 -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 +149 -0
- mapproxy/featureinfo.py +251 -0
- mapproxy/grid.py +1199 -0
- mapproxy/image/__init__.py +549 -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 +79 -0
- mapproxy/image/merge.py +323 -0
- mapproxy/image/message.py +357 -0
- mapproxy/image/opts.py +185 -0
- mapproxy/image/tile.py +171 -0
- mapproxy/image/transform.py +350 -0
- mapproxy/layer.py +489 -0
- mapproxy/multiapp.py +230 -0
- mapproxy/proj.py +309 -0
- mapproxy/request/__init__.py +18 -0
- mapproxy/request/arcgis.py +268 -0
- mapproxy/request/base.py +466 -0
- mapproxy/request/tile.py +131 -0
- mapproxy/request/wms/__init__.py +829 -0
- mapproxy/request/wms/exception.py +107 -0
- mapproxy/request/wmts.py +442 -0
- mapproxy/response.py +237 -0
- mapproxy/script/__init__.py +0 -0
- mapproxy/script/conf/__init__.py +0 -0
- mapproxy/script/conf/app.py +222 -0
- mapproxy/script/conf/caches.py +44 -0
- mapproxy/script/conf/geopackage.py +136 -0
- mapproxy/script/conf/layers.py +54 -0
- mapproxy/script/conf/seeds.py +36 -0
- mapproxy/script/conf/sources.py +88 -0
- mapproxy/script/conf/utils.py +148 -0
- mapproxy/script/defrag.py +187 -0
- mapproxy/script/export.py +337 -0
- mapproxy/script/grids.py +198 -0
- mapproxy/script/scales.py +134 -0
- mapproxy/script/util.py +410 -0
- mapproxy/script/wms_capabilities.py +160 -0
- mapproxy/seed/__init__.py +0 -0
- mapproxy/seed/cachelock.py +127 -0
- mapproxy/seed/cleanup.py +191 -0
- mapproxy/seed/config.py +481 -0
- mapproxy/seed/script.py +391 -0
- mapproxy/seed/seeder.py +551 -0
- mapproxy/seed/spec.py +66 -0
- mapproxy/seed/util.py +266 -0
- mapproxy/service/__init__.py +14 -0
- mapproxy/service/base.py +45 -0
- mapproxy/service/demo.py +364 -0
- mapproxy/service/kml.py +333 -0
- mapproxy/service/ows.py +39 -0
- mapproxy/service/template_helper.py +55 -0
- mapproxy/service/templates/demo/capabilities_demo.html +18 -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 +117 -0
- mapproxy/service/templates/demo/wms_demo.html +144 -0
- mapproxy/service/templates/demo/wmts_demo.html +118 -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 +540 -0
- mapproxy/service/wms.py +868 -0
- mapproxy/service/wmts.py +387 -0
- mapproxy/source/__init__.py +83 -0
- mapproxy/source/arcgis.py +39 -0
- mapproxy/source/error.py +40 -0
- mapproxy/source/mapnik.py +262 -0
- mapproxy/source/tile.py +97 -0
- mapproxy/source/wms.py +273 -0
- mapproxy/srs.py +734 -0
- mapproxy/template.py +54 -0
- mapproxy/test/__init__.py +0 -0
- mapproxy/test/conftest.py +8 -0
- mapproxy/test/helper.py +255 -0
- mapproxy/test/http.py +511 -0
- mapproxy/test/image.py +219 -0
- mapproxy/test/mocker.py +2291 -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_coverage.yaml +84 -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 +111 -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 +29 -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 +1133 -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_coverage.py +168 -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 +56 -0
- mapproxy/test/system/test_demo_with_extra_service.py +57 -0
- mapproxy/test/system/test_dimensions.py +279 -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 +264 -0
- mapproxy/test/system/test_layergroups.py +160 -0
- mapproxy/test/system/test_legendgraphic.py +308 -0
- mapproxy/test/system/test_mapnik.py +162 -0
- mapproxy/test/system/test_mapserver.py +83 -0
- mapproxy/test/system/test_mixed_mode_format.py +201 -0
- mapproxy/test/system/test_multi_cache_layers.py +169 -0
- mapproxy/test/system/test_multiapp.py +92 -0
- mapproxy/test/system/test_refresh.py +206 -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 +425 -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 +277 -0
- mapproxy/test/system/test_tms_origin.py +46 -0
- mapproxy/test/system/test_util_conf.py +434 -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 +1616 -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 +423 -0
- mapproxy/test/test_http_helper.py +217 -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 +242 -0
- mapproxy/test/unit/test_auth.py +430 -0
- mapproxy/test/unit/test_cache.py +1356 -0
- mapproxy/test/unit/test_cache_azureblob.py +97 -0
- mapproxy/test/unit/test_cache_compact.py +324 -0
- mapproxy/test/unit/test_cache_couchdb.py +118 -0
- mapproxy/test/unit/test_cache_geopackage.py +256 -0
- mapproxy/test/unit/test_cache_redis.py +123 -0
- mapproxy/test/unit/test_cache_riak.py +80 -0
- mapproxy/test/unit/test_cache_s3.py +93 -0
- mapproxy/test/unit/test_cache_tile.py +477 -0
- mapproxy/test/unit/test_client.py +488 -0
- mapproxy/test/unit/test_client_arcgis.py +74 -0
- mapproxy/test/unit/test_client_cgi.py +140 -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 +1267 -0
- mapproxy/test/unit/test_conf_validator.py +427 -0
- mapproxy/test/unit/test_config.py +118 -0
- mapproxy/test/unit/test_decorate_img.py +185 -0
- mapproxy/test/unit/test_exceptions.py +270 -0
- mapproxy/test/unit/test_featureinfo.py +313 -0
- mapproxy/test/unit/test_file_lock_load.py +49 -0
- mapproxy/test/unit/test_geom.py +512 -0
- mapproxy/test/unit/test_grid.py +1279 -0
- mapproxy/test/unit/test_image.py +1051 -0
- mapproxy/test/unit/test_image_mask.py +181 -0
- mapproxy/test/unit/test_image_messages.py +209 -0
- mapproxy/test/unit/test_image_options.py +160 -0
- mapproxy/test/unit/test_isodate.py +118 -0
- mapproxy/test/unit/test_multiapp.py +163 -0
- mapproxy/test/unit/test_ogr_reader.py +51 -0
- mapproxy/test/unit/test_request.py +745 -0
- mapproxy/test/unit/test_request_wmts.py +178 -0
- mapproxy/test/unit/test_response.py +78 -0
- mapproxy/test/unit/test_seed.py +365 -0
- mapproxy/test/unit/test_seed_cachelock.py +91 -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 +68 -0
- mapproxy/tilefilter.py +61 -0
- mapproxy/util/__init__.py +0 -0
- mapproxy/util/async_.py +229 -0
- mapproxy/util/collections.py +134 -0
- mapproxy/util/coverage.py +337 -0
- mapproxy/util/ext/__init__.py +14 -0
- mapproxy/util/ext/dictspec/__init__.py +1 -0
- mapproxy/util/ext/dictspec/spec.py +131 -0
- mapproxy/util/ext/dictspec/test/__init__.py +0 -0
- mapproxy/util/ext/dictspec/test/test_validator.py +278 -0
- mapproxy/util/ext/dictspec/validator.py +194 -0
- mapproxy/util/ext/local.py +198 -0
- mapproxy/util/ext/lockfile.py +140 -0
- mapproxy/util/ext/odict.py +321 -0
- mapproxy/util/ext/serving.py +491 -0
- mapproxy/util/ext/tempita/__init__.py +1093 -0
- mapproxy/util/ext/tempita/_looper.py +163 -0
- mapproxy/util/ext/tempita/string_utils.py +24 -0
- mapproxy/util/ext/wmsparse/__init__.py +3 -0
- mapproxy/util/ext/wmsparse/duration.py +600 -0
- mapproxy/util/ext/wmsparse/parse.py +307 -0
- mapproxy/util/ext/wmsparse/test/__init__.py +0 -0
- mapproxy/util/ext/wmsparse/test/test_parse.py +111 -0
- mapproxy/util/ext/wmsparse/test/test_util.py +23 -0
- mapproxy/util/ext/wmsparse/test/wms-example-111.xml +90 -0
- mapproxy/util/ext/wmsparse/test/wms-example-130.xml +120 -0
- mapproxy/util/ext/wmsparse/test/wms-large-111.xml +2114 -0
- mapproxy/util/ext/wmsparse/test/wms_nasa_cap.xml +386 -0
- mapproxy/util/ext/wmsparse/util.py +189 -0
- mapproxy/util/fs.py +164 -0
- mapproxy/util/geom.py +307 -0
- mapproxy/util/lib.py +117 -0
- mapproxy/util/lock.py +171 -0
- mapproxy/util/ogr.py +247 -0
- mapproxy/util/py.py +75 -0
- mapproxy/util/times.py +78 -0
- mapproxy/util/yaml.py +58 -0
- mapproxy/version.py +33 -0
- mapproxy/wsgiapp.py +167 -0
|
@@ -0,0 +1,745 @@
|
|
|
1
|
+
# -:- encoding: UTF8 -:-
|
|
2
|
+
# This file is part of the MapProxy project.
|
|
3
|
+
# Copyright (C) 2010 Omniscale <http://omniscale.de>
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
from __future__ import print_function
|
|
18
|
+
|
|
19
|
+
import pickle
|
|
20
|
+
|
|
21
|
+
import pytest
|
|
22
|
+
|
|
23
|
+
from mapproxy.srs import SRS
|
|
24
|
+
from mapproxy.request.base import url_decode, Request, NoCaseMultiDict, RequestParams
|
|
25
|
+
from mapproxy.request.tile import TMSRequest, tile_request, TileRequest
|
|
26
|
+
from mapproxy.request.wms import (
|
|
27
|
+
wms_request,
|
|
28
|
+
WMSMapRequest,
|
|
29
|
+
WMSMapRequestParams,
|
|
30
|
+
WMS111MapRequest,
|
|
31
|
+
WMS100MapRequest,
|
|
32
|
+
WMS130MapRequest,
|
|
33
|
+
WMS111FeatureInfoRequest,
|
|
34
|
+
)
|
|
35
|
+
from mapproxy.request.arcgis import ArcGISRequest, ArcGISIdentifyRequest
|
|
36
|
+
from mapproxy.exception import RequestError
|
|
37
|
+
from mapproxy.request.wms.exception import (
|
|
38
|
+
WMS111ExceptionHandler,
|
|
39
|
+
WMSImageExceptionHandler,
|
|
40
|
+
WMSBlankExceptionHandler,
|
|
41
|
+
)
|
|
42
|
+
from mapproxy.test.http import make_wsgi_env, assert_url_eq, assert_query_eq
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class TestNoCaseMultiDict(object):
|
|
46
|
+
|
|
47
|
+
def test_from_iterable(self):
|
|
48
|
+
data = (("layers", "foo,bar"), ("laYERs", "baz"), ("crs", "EPSG:4326"))
|
|
49
|
+
nc_dict = NoCaseMultiDict(data)
|
|
50
|
+
print(nc_dict)
|
|
51
|
+
|
|
52
|
+
for name in ("layers", "LAYERS", "lAYeRS"):
|
|
53
|
+
assert name in nc_dict, name + " not found"
|
|
54
|
+
assert nc_dict.get_all("layers") == ["foo,bar", "baz"]
|
|
55
|
+
assert nc_dict.get_all("crs") == ["EPSG:4326"]
|
|
56
|
+
|
|
57
|
+
def test_from_dict(self):
|
|
58
|
+
data = [("layers", "foo,bar"), ("laYERs", "baz"), ("crs", "EPSG:4326")]
|
|
59
|
+
nc_dict = NoCaseMultiDict(data)
|
|
60
|
+
print(nc_dict)
|
|
61
|
+
|
|
62
|
+
for name in ("layers", "LAYERS", "lAYeRS"):
|
|
63
|
+
assert name in nc_dict, name + " not found"
|
|
64
|
+
assert nc_dict.get_all("layers") == ["foo,bar", "baz"]
|
|
65
|
+
assert nc_dict.get_all("crs") == ["EPSG:4326"]
|
|
66
|
+
|
|
67
|
+
def test_iteritems(self):
|
|
68
|
+
data = [("LAYERS", "foo,bar"), ("laYERs", "baz"), ("crs", "EPSG:4326")]
|
|
69
|
+
nc_dict = NoCaseMultiDict(data)
|
|
70
|
+
|
|
71
|
+
for key, values in nc_dict.iteritems():
|
|
72
|
+
if key in ("LAYERS", "laYERs"):
|
|
73
|
+
assert values == ["foo,bar", "baz"]
|
|
74
|
+
elif key == "crs":
|
|
75
|
+
assert values == ["EPSG:4326"]
|
|
76
|
+
else:
|
|
77
|
+
assert False, "unexpected key " + key
|
|
78
|
+
|
|
79
|
+
def test_multiple_sets(self):
|
|
80
|
+
nc_dict = NoCaseMultiDict()
|
|
81
|
+
nc_dict["foo"] = "bar"
|
|
82
|
+
assert nc_dict["FOO"] == "bar"
|
|
83
|
+
nc_dict["foo"] = "baz"
|
|
84
|
+
assert nc_dict["FOO"] == "baz"
|
|
85
|
+
|
|
86
|
+
def test_missing_key(self):
|
|
87
|
+
nc_dict = NoCaseMultiDict([("foo", "bar")])
|
|
88
|
+
try:
|
|
89
|
+
nc_dict["bar"]
|
|
90
|
+
assert False, "Did not throw KeyError exception."
|
|
91
|
+
except KeyError:
|
|
92
|
+
pass
|
|
93
|
+
|
|
94
|
+
def test_get(self):
|
|
95
|
+
nc_dict = NoCaseMultiDict([("foo", "bar"), ("num", "42")])
|
|
96
|
+
assert nc_dict.get("bar") is None
|
|
97
|
+
assert nc_dict.get("bar", "default_bar") == "default_bar"
|
|
98
|
+
assert nc_dict.get("num") == "42"
|
|
99
|
+
assert nc_dict.get("num", type_func=int) == 42
|
|
100
|
+
assert nc_dict.get("foo") == "bar"
|
|
101
|
+
|
|
102
|
+
def test_get_all(self):
|
|
103
|
+
nc_dict = NoCaseMultiDict([("foo", "bar"), ("num", "42"), ("foo", "biz")])
|
|
104
|
+
assert nc_dict.get_all("bar") == []
|
|
105
|
+
assert nc_dict.get_all("foo") == ["bar", "biz"]
|
|
106
|
+
assert nc_dict.get_all("num") == ["42"]
|
|
107
|
+
|
|
108
|
+
def test_set(self):
|
|
109
|
+
nc_dict = NoCaseMultiDict()
|
|
110
|
+
nc_dict.set("foo", "bar")
|
|
111
|
+
assert nc_dict.get_all("fOO") == ["bar"]
|
|
112
|
+
nc_dict.set("fOo", "buzz", append=True)
|
|
113
|
+
assert nc_dict.get_all("FOO") == ["bar", "buzz"]
|
|
114
|
+
nc_dict.set("foO", "bizz")
|
|
115
|
+
assert nc_dict.get_all("FOO") == ["bizz"]
|
|
116
|
+
nc_dict.set("foO", ["ham", "spam"], unpack=True)
|
|
117
|
+
assert nc_dict.get_all("FOO") == ["ham", "spam"]
|
|
118
|
+
nc_dict.set("FoO", ["egg", "bacon"], append=True, unpack=True)
|
|
119
|
+
assert nc_dict.get_all("FOo") == ["ham", "spam", "egg", "bacon"]
|
|
120
|
+
|
|
121
|
+
def test_setitem(self):
|
|
122
|
+
nc_dict = NoCaseMultiDict()
|
|
123
|
+
nc_dict["foo"] = "bar"
|
|
124
|
+
assert nc_dict["foo"] == "bar"
|
|
125
|
+
nc_dict["foo"] = "buz"
|
|
126
|
+
assert nc_dict["foo"] == "buz"
|
|
127
|
+
nc_dict["bar"] = nc_dict["foo"]
|
|
128
|
+
assert nc_dict["bar"] == "buz"
|
|
129
|
+
|
|
130
|
+
nc_dict["bing"] = "1"
|
|
131
|
+
nc_dict["bong"] = "2"
|
|
132
|
+
nc_dict["bing"] = nc_dict["bong"]
|
|
133
|
+
assert nc_dict["bing"] == "2"
|
|
134
|
+
assert nc_dict["bong"] == "2"
|
|
135
|
+
|
|
136
|
+
def test_del(self):
|
|
137
|
+
nc_dict = NoCaseMultiDict([("foo", "bar"), ("num", "42")])
|
|
138
|
+
assert nc_dict["fOO"] == "bar"
|
|
139
|
+
del nc_dict["FOO"]
|
|
140
|
+
assert nc_dict.get("foo") is None
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
class DummyRequest(object):
|
|
144
|
+
|
|
145
|
+
def __init__(self, args, url=""):
|
|
146
|
+
self.args = args
|
|
147
|
+
self.base_url = url
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
class TestWMSMapRequest(object):
|
|
151
|
+
|
|
152
|
+
def setup_method(self):
|
|
153
|
+
self.base_req = url_decode(
|
|
154
|
+
"""SERVICE=WMS&format=image%2Fpng&layers=foo&styles=&
|
|
155
|
+
REQUEST=GetMap&height=300&srs=EPSG%3A4326&VERSION=1.1.1&
|
|
156
|
+
bbox=7,50,8,51&width=400""".replace(
|
|
157
|
+
"\n", ""
|
|
158
|
+
)
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
class TestWMS100MapRequest(TestWMSMapRequest):
|
|
163
|
+
|
|
164
|
+
def setup_method(self):
|
|
165
|
+
TestWMSMapRequest.setup_method(self)
|
|
166
|
+
del self.base_req["service"]
|
|
167
|
+
del self.base_req["version"]
|
|
168
|
+
self.base_req["wmtver"] = "1.0.0"
|
|
169
|
+
self.base_req["request"] = "Map"
|
|
170
|
+
|
|
171
|
+
def test_basic_request(self):
|
|
172
|
+
req = wms_request(DummyRequest(self.base_req), validate=False)
|
|
173
|
+
assert isinstance(req, WMS100MapRequest)
|
|
174
|
+
assert req.params.request == "GetMap"
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
class TestWMS111MapRequest(TestWMSMapRequest):
|
|
178
|
+
|
|
179
|
+
def test_basic_request(self):
|
|
180
|
+
req = wms_request(DummyRequest(self.base_req), validate=False)
|
|
181
|
+
assert isinstance(req, WMS111MapRequest)
|
|
182
|
+
assert req.params.request == "GetMap"
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
class TestWMS130MapRequest(TestWMSMapRequest):
|
|
186
|
+
|
|
187
|
+
def setup_method(self):
|
|
188
|
+
TestWMSMapRequest.setup_method(self)
|
|
189
|
+
self.base_req["version"] = "1.3.0"
|
|
190
|
+
self.base_req["crs"] = self.base_req["srs"]
|
|
191
|
+
del self.base_req["srs"]
|
|
192
|
+
|
|
193
|
+
def test_basic_request(self):
|
|
194
|
+
req = wms_request(DummyRequest(self.base_req), validate=False)
|
|
195
|
+
assert isinstance(req, WMS130MapRequest)
|
|
196
|
+
assert req.params.request == "GetMap"
|
|
197
|
+
assert req.params.bbox == (50.0, 7.0, 51.0, 8.0)
|
|
198
|
+
|
|
199
|
+
def test_copy_with_request_params(self):
|
|
200
|
+
# check that we allways have our internal axis order
|
|
201
|
+
req1 = WMS130MapRequest(param=dict(bbox="10,0,20,40", crs="EPSG:4326"))
|
|
202
|
+
assert req1.params.bbox == (0.0, 10.0, 40.0, 20.0)
|
|
203
|
+
req2 = WMS111MapRequest(param=dict(bbox="0,10,40,20", srs="EPSG:4326"))
|
|
204
|
+
assert req2.params.bbox == (0.0, 10.0, 40.0, 20.0)
|
|
205
|
+
|
|
206
|
+
# 130 <- 111
|
|
207
|
+
req3 = req1.copy_with_request_params(req2)
|
|
208
|
+
assert req3.params.bbox == (0.0, 10.0, 40.0, 20.0)
|
|
209
|
+
assert isinstance(req3, WMS130MapRequest)
|
|
210
|
+
|
|
211
|
+
# 130 <- 130
|
|
212
|
+
req4 = req1.copy_with_request_params(req3)
|
|
213
|
+
assert req4.params.bbox == (0.0, 10.0, 40.0, 20.0)
|
|
214
|
+
assert isinstance(req4, WMS130MapRequest)
|
|
215
|
+
|
|
216
|
+
# 111 <- 130
|
|
217
|
+
req5 = req2.copy_with_request_params(req3)
|
|
218
|
+
assert req5.params.bbox == (0.0, 10.0, 40.0, 20.0)
|
|
219
|
+
assert isinstance(req5, WMS111MapRequest)
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
class TestWMS111FeatureInfoRequest(TestWMSMapRequest):
|
|
223
|
+
|
|
224
|
+
def setup_method(self):
|
|
225
|
+
TestWMSMapRequest.setup_method(self)
|
|
226
|
+
self.base_req["request"] = "GetFeatureInfo"
|
|
227
|
+
self.base_req["x"] = "100"
|
|
228
|
+
self.base_req["y"] = "150"
|
|
229
|
+
self.base_req["query_layers"] = "foo"
|
|
230
|
+
|
|
231
|
+
def test_basic_request(self):
|
|
232
|
+
req = wms_request(DummyRequest(self.base_req)) # , validate=False)
|
|
233
|
+
assert isinstance(req, WMS111FeatureInfoRequest)
|
|
234
|
+
|
|
235
|
+
def test_pos(self):
|
|
236
|
+
req = wms_request(DummyRequest(self.base_req))
|
|
237
|
+
assert req.params.pos == (100, 150)
|
|
238
|
+
|
|
239
|
+
def test_pos_coords(self):
|
|
240
|
+
req = wms_request(DummyRequest(self.base_req))
|
|
241
|
+
assert req.params.pos_coords == (7.25, 50.5)
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
class TestArcGISRequest(object):
|
|
245
|
+
|
|
246
|
+
def test_base_request(self):
|
|
247
|
+
req = ArcGISRequest(url="http://example.com/ArcGIS/rest/MapServer/")
|
|
248
|
+
assert "http://example.com/ArcGIS/rest/MapServer/export" == req.url
|
|
249
|
+
req.params.bbox = [-180.0, -90.0, 180.0, 90.0]
|
|
250
|
+
assert (-180.0, -90.0, 180.0, 90.0) == req.params.bbox
|
|
251
|
+
assert "-180.0,-90.0,180.0,90.0" == req.params["bbox"]
|
|
252
|
+
req.params.size = [256, 256]
|
|
253
|
+
assert (256, 256) == req.params.size
|
|
254
|
+
assert "256,256" == req.params["size"]
|
|
255
|
+
req.params.imageSR = "EPSG:4326"
|
|
256
|
+
assert "4326" == req.params.imageSR
|
|
257
|
+
assert "4326" == req.params["imageSR"]
|
|
258
|
+
req.params.bboxSR = SRS("EPSG:4326")
|
|
259
|
+
assert "4326" == req.params.bboxSR
|
|
260
|
+
assert "4326" == req.params["bboxSR"]
|
|
261
|
+
|
|
262
|
+
@pytest.mark.parametrize(
|
|
263
|
+
"url,expected",
|
|
264
|
+
[
|
|
265
|
+
[
|
|
266
|
+
"http://example.com/ArcGIS/rest/MapServer/",
|
|
267
|
+
"http://example.com/ArcGIS/rest/MapServer/export",
|
|
268
|
+
],
|
|
269
|
+
[
|
|
270
|
+
"http://example.com/ArcGIS/rest/MapServer",
|
|
271
|
+
"http://example.com/ArcGIS/rest/MapServer/export",
|
|
272
|
+
],
|
|
273
|
+
[
|
|
274
|
+
"http://example.com/ArcGIS/rest/MapServer/export",
|
|
275
|
+
"http://example.com/ArcGIS/rest/MapServer/export",
|
|
276
|
+
],
|
|
277
|
+
[
|
|
278
|
+
"http://example.com/ArcGIS/rest/ImageServer/",
|
|
279
|
+
"http://example.com/ArcGIS/rest/ImageServer/exportImage",
|
|
280
|
+
],
|
|
281
|
+
[
|
|
282
|
+
"http://example.com/ArcGIS/rest/ImageServer",
|
|
283
|
+
"http://example.com/ArcGIS/rest/ImageServer/exportImage",
|
|
284
|
+
],
|
|
285
|
+
[
|
|
286
|
+
"http://example.com/ArcGIS/rest/ImageServer/export",
|
|
287
|
+
"http://example.com/ArcGIS/rest/ImageServer/exportImage",
|
|
288
|
+
],
|
|
289
|
+
[
|
|
290
|
+
"http://example.com/ArcGIS/rest/ImageServer/exportImage",
|
|
291
|
+
"http://example.com/ArcGIS/rest/ImageServer/exportImage",
|
|
292
|
+
],
|
|
293
|
+
[
|
|
294
|
+
"http://example.com/ArcGIS/rest/MapServer/export?param=foo",
|
|
295
|
+
"http://example.com/ArcGIS/rest/MapServer/export?param=foo",
|
|
296
|
+
],
|
|
297
|
+
[
|
|
298
|
+
"http://example.com/ArcGIS/rest/ImageServer/export?param=foo",
|
|
299
|
+
"http://example.com/ArcGIS/rest/ImageServer/exportImage?param=foo",
|
|
300
|
+
],
|
|
301
|
+
],
|
|
302
|
+
)
|
|
303
|
+
def test_endpoint_urls(self, url, expected):
|
|
304
|
+
req = ArcGISRequest(url=url)
|
|
305
|
+
assert req.url == expected
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
class TestArcGISIndentifyRequest(object):
|
|
309
|
+
|
|
310
|
+
def test_base_request(self):
|
|
311
|
+
req = ArcGISIdentifyRequest(url="http://example.com/ArcGIS/rest/MapServer/")
|
|
312
|
+
assert "http://example.com/ArcGIS/rest/MapServer/identify" == req.url
|
|
313
|
+
req.params.bbox = [-180.0, -90.0, 180.0, 90.0]
|
|
314
|
+
assert (-180.0, -90.0, 180.0, 90.0) == req.params.bbox
|
|
315
|
+
assert "-180.0,-90.0,180.0,90.0" == req.params["mapExtent"]
|
|
316
|
+
req.params.size = [256, 256]
|
|
317
|
+
assert (256, 256) == req.params.size
|
|
318
|
+
assert "256,256,96" == req.params["imageDisplay"]
|
|
319
|
+
req.params.srs = "EPSG:4326"
|
|
320
|
+
assert "EPSG:4326" == req.params.srs
|
|
321
|
+
assert "4326" == req.params["sr"]
|
|
322
|
+
|
|
323
|
+
@pytest.mark.parametrize(
|
|
324
|
+
"url,expected",
|
|
325
|
+
[
|
|
326
|
+
[
|
|
327
|
+
"http://example.com/ArcGIS/rest/MapServer/",
|
|
328
|
+
"http://example.com/ArcGIS/rest/MapServer/identify",
|
|
329
|
+
],
|
|
330
|
+
[
|
|
331
|
+
"http://example.com/ArcGIS/rest/MapServer",
|
|
332
|
+
"http://example.com/ArcGIS/rest/MapServer/identify",
|
|
333
|
+
],
|
|
334
|
+
[
|
|
335
|
+
"http://example.com/ArcGIS/rest/MapServer/export",
|
|
336
|
+
"http://example.com/ArcGIS/rest/MapServer/identify",
|
|
337
|
+
],
|
|
338
|
+
[
|
|
339
|
+
"http://example.com/ArcGIS/rest/ImageServer/",
|
|
340
|
+
"http://example.com/ArcGIS/rest/ImageServer/identify",
|
|
341
|
+
],
|
|
342
|
+
[
|
|
343
|
+
"http://example.com/ArcGIS/rest/ImageServer",
|
|
344
|
+
"http://example.com/ArcGIS/rest/ImageServer/identify",
|
|
345
|
+
],
|
|
346
|
+
[
|
|
347
|
+
"http://example.com/ArcGIS/rest/ImageServer/export",
|
|
348
|
+
"http://example.com/ArcGIS/rest/ImageServer/identify",
|
|
349
|
+
],
|
|
350
|
+
[
|
|
351
|
+
"http://example.com/ArcGIS/rest/ImageServer/exportImage",
|
|
352
|
+
"http://example.com/ArcGIS/rest/ImageServer/identify",
|
|
353
|
+
],
|
|
354
|
+
[
|
|
355
|
+
"http://example.com/ArcGIS/rest/MapServer/export?param=foo",
|
|
356
|
+
"http://example.com/ArcGIS/rest/MapServer/identify?param=foo",
|
|
357
|
+
],
|
|
358
|
+
[
|
|
359
|
+
"http://example.com/ArcGIS/rest/ImageServer/export?param=foo",
|
|
360
|
+
"http://example.com/ArcGIS/rest/ImageServer/identify?param=foo",
|
|
361
|
+
],
|
|
362
|
+
],
|
|
363
|
+
)
|
|
364
|
+
def test_endpoint_urls(self, url, expected):
|
|
365
|
+
req = ArcGISIdentifyRequest(url=url)
|
|
366
|
+
assert req.url == expected
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
class TestRequest(object):
|
|
370
|
+
|
|
371
|
+
def setup_method(self):
|
|
372
|
+
self.env = {
|
|
373
|
+
"HTTP_HOST": "localhost:5050",
|
|
374
|
+
"PATH_INFO": "/service",
|
|
375
|
+
"QUERY_STRING": "LAYERS=osm_mapnik&FORMAT=image%2Fpng&SPHERICALMERCATOR=true&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A900913&bbox=1013566.9382067363,7051939.297837454,1030918.1436243634,7069577.142111099&WIDTH=908&HEIGHT=923", # noqa
|
|
376
|
+
"REMOTE_ADDR": "127.0.0.1",
|
|
377
|
+
"REQUEST_METHOD": "GET",
|
|
378
|
+
"SCRIPT_NAME": "",
|
|
379
|
+
"SERVER_NAME": "127.0.0.1",
|
|
380
|
+
"SERVER_PORT": "5050",
|
|
381
|
+
"SERVER_PROTOCOL": "HTTP/1.1",
|
|
382
|
+
"wsgi.url_scheme": "http",
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
def test_path(self):
|
|
386
|
+
req = Request(self.env)
|
|
387
|
+
assert req.path == "/service"
|
|
388
|
+
|
|
389
|
+
def test_host_url(self):
|
|
390
|
+
req = Request(self.env)
|
|
391
|
+
assert req.host_url == "http://localhost:5050/"
|
|
392
|
+
|
|
393
|
+
def test_base_url(self):
|
|
394
|
+
req = Request(self.env)
|
|
395
|
+
assert req.base_url == "http://localhost:5050/service"
|
|
396
|
+
|
|
397
|
+
del self.env["HTTP_HOST"]
|
|
398
|
+
req = Request(self.env)
|
|
399
|
+
assert req.base_url == "http://127.0.0.1:5050/service"
|
|
400
|
+
|
|
401
|
+
self.env["SERVER_PORT"] = "80"
|
|
402
|
+
req = Request(self.env)
|
|
403
|
+
assert req.base_url == "http://127.0.0.1/service"
|
|
404
|
+
|
|
405
|
+
def test_query_string(self):
|
|
406
|
+
self.env["QUERY_STRING"] = "Foo=boo&baz=baa&fOO=bizz"
|
|
407
|
+
req = Request(self.env)
|
|
408
|
+
print(req.args["foo"])
|
|
409
|
+
assert req.args.get_all("foo") == ["boo", "bizz"]
|
|
410
|
+
|
|
411
|
+
def test_query_string_encoding(self):
|
|
412
|
+
env = {"QUERY_STRING": "foo=some%20special%20chars%20%26%20%3D"}
|
|
413
|
+
req = Request(env)
|
|
414
|
+
print(req.args["foo"])
|
|
415
|
+
assert req.args["foo"] == u"some special chars & ="
|
|
416
|
+
|
|
417
|
+
def test_script_url(self):
|
|
418
|
+
req = Request(self.env)
|
|
419
|
+
assert req.script_url == "http://localhost:5050"
|
|
420
|
+
self.env["SCRIPT_NAME"] = "/"
|
|
421
|
+
req = Request(self.env)
|
|
422
|
+
assert req.script_url == "http://localhost:5050"
|
|
423
|
+
|
|
424
|
+
self.env["SCRIPT_NAME"] = "/proxy"
|
|
425
|
+
req = Request(self.env)
|
|
426
|
+
assert req.script_url == "http://localhost:5050/proxy"
|
|
427
|
+
|
|
428
|
+
self.env["SCRIPT_NAME"] = "/proxy/"
|
|
429
|
+
req = Request(self.env)
|
|
430
|
+
assert req.script_url == "http://localhost:5050/proxy"
|
|
431
|
+
|
|
432
|
+
def test_pop_path(self):
|
|
433
|
+
self.env["PATH_INFO"] = "/foo/service"
|
|
434
|
+
req = Request(self.env)
|
|
435
|
+
part = req.pop_path()
|
|
436
|
+
assert part == "foo"
|
|
437
|
+
assert self.env["PATH_INFO"] == "/service"
|
|
438
|
+
assert self.env["SCRIPT_NAME"] == "/foo"
|
|
439
|
+
|
|
440
|
+
part = req.pop_path()
|
|
441
|
+
assert part == "service"
|
|
442
|
+
assert self.env["PATH_INFO"] == ""
|
|
443
|
+
assert self.env["SCRIPT_NAME"] == "/foo/service"
|
|
444
|
+
|
|
445
|
+
part = req.pop_path()
|
|
446
|
+
assert part == ""
|
|
447
|
+
assert self.env["PATH_INFO"] == ""
|
|
448
|
+
assert self.env["SCRIPT_NAME"] == "/foo/service"
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
def test_maprequest_from_request():
|
|
452
|
+
env = {
|
|
453
|
+
"QUERY_STRING": "layers=bar&bBOx=-90,-80,70.0,+80&format=image/png&"
|
|
454
|
+
"WIdth=100&heIGHT=200&LAyerS=foo"
|
|
455
|
+
}
|
|
456
|
+
req = WMSMapRequest(param=Request(env).args)
|
|
457
|
+
assert req.params.bbox == (-90.0, -80.0, 70.0, 80.0)
|
|
458
|
+
assert req.params.layers == ["bar", "foo"]
|
|
459
|
+
assert req.params.size == (100, 200)
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
class TestWMSMapRequestParams(object):
|
|
463
|
+
|
|
464
|
+
def setup_method(self):
|
|
465
|
+
self.m = WMSMapRequestParams(
|
|
466
|
+
url_decode(
|
|
467
|
+
"layers=bar&bBOx=-90,-80,70.0, 80&format=image/png"
|
|
468
|
+
"&WIdth=100&heIGHT=200&LAyerS=foo&srs=EPSG%3A0815"
|
|
469
|
+
)
|
|
470
|
+
)
|
|
471
|
+
|
|
472
|
+
def test_empty(self):
|
|
473
|
+
m = WMSMapRequestParams()
|
|
474
|
+
assert m.query_string == ""
|
|
475
|
+
|
|
476
|
+
def test_size(self):
|
|
477
|
+
assert self.m.size == (100, 200)
|
|
478
|
+
self.m.size = (250, 350)
|
|
479
|
+
assert self.m.size == (250, 350)
|
|
480
|
+
assert self.m["width"] == "250"
|
|
481
|
+
assert self.m["height"] == "350"
|
|
482
|
+
del self.m["width"]
|
|
483
|
+
assert self.m.size is None
|
|
484
|
+
|
|
485
|
+
def test_format(self):
|
|
486
|
+
assert self.m.format == "png"
|
|
487
|
+
assert self.m.format_mime_type == "image/png"
|
|
488
|
+
self.m["transparent"] = "True"
|
|
489
|
+
assert self.m.format == "png"
|
|
490
|
+
|
|
491
|
+
def test_bbox(self):
|
|
492
|
+
assert self.m.bbox == (-90.0, -80.0, 70.0, 80.0)
|
|
493
|
+
del self.m["bbox"]
|
|
494
|
+
assert self.m.bbox is None
|
|
495
|
+
self.m.bbox = (-90.0, -80.0, 70.0, 80.0)
|
|
496
|
+
assert self.m.bbox == (-90.0, -80.0, 70.0, 80.0)
|
|
497
|
+
self.m.bbox = "0.0, -40.0, 70.0, 80.0"
|
|
498
|
+
assert self.m.bbox == (0.0, -40.0, 70.0, 80.0)
|
|
499
|
+
self.m.bbox = None
|
|
500
|
+
assert self.m.bbox is None
|
|
501
|
+
|
|
502
|
+
def test_transparent(self):
|
|
503
|
+
assert self.m.transparent is False
|
|
504
|
+
self.m["transparent"] = "trUe"
|
|
505
|
+
assert self.m.transparent is True
|
|
506
|
+
|
|
507
|
+
def test_transparent_bool(self):
|
|
508
|
+
self.m["transparent"] = True
|
|
509
|
+
assert self.m["transparent"] == "True"
|
|
510
|
+
|
|
511
|
+
def test_bgcolor(self):
|
|
512
|
+
assert self.m.bgcolor == "#ffffff"
|
|
513
|
+
self.m["bgcolor"] = "0x42cafe"
|
|
514
|
+
assert self.m.bgcolor == "#42cafe"
|
|
515
|
+
|
|
516
|
+
def test_srs(self):
|
|
517
|
+
print(self.m.srs)
|
|
518
|
+
assert self.m.srs == "EPSG:0815"
|
|
519
|
+
del self.m["srs"]
|
|
520
|
+
assert self.m.srs is None
|
|
521
|
+
self.m.srs = SRS("EPSG:4326")
|
|
522
|
+
assert self.m.srs == "EPSG:4326"
|
|
523
|
+
|
|
524
|
+
def test_layers(self):
|
|
525
|
+
assert list(self.m.layers) == ["bar", "foo"]
|
|
526
|
+
|
|
527
|
+
def test_query_string(self):
|
|
528
|
+
assert_query_eq(
|
|
529
|
+
self.m.query_string,
|
|
530
|
+
"layers=bar,foo&WIdth=100&bBOx=-90,-80,70.0,+80"
|
|
531
|
+
"&format=image%2Fpng&srs=EPSG%3A0815&heIGHT=200",
|
|
532
|
+
)
|
|
533
|
+
|
|
534
|
+
def test_query_string_encoding(self):
|
|
535
|
+
m = WMSMapRequestParams()
|
|
536
|
+
m.layers = ["layer with whitespace", u"layer with ümlauts"]
|
|
537
|
+
assert (
|
|
538
|
+
m.query_string
|
|
539
|
+
== "layers=layer%20with%20whitespace,layer%20with%20%C3%BCmlauts"
|
|
540
|
+
)
|
|
541
|
+
|
|
542
|
+
def test_get(self):
|
|
543
|
+
assert self.m.get("LAYERS") == "bar"
|
|
544
|
+
assert self.m.get("width", type_func=int) == 100
|
|
545
|
+
|
|
546
|
+
def test_set(self):
|
|
547
|
+
self.m.set("Layers", "baz", append=True)
|
|
548
|
+
assert self.m.get("LAYERS") == "bar"
|
|
549
|
+
self.m.set("Layers", "baz")
|
|
550
|
+
assert self.m.get("LAYERS") == "baz"
|
|
551
|
+
|
|
552
|
+
def test_attr_access(self):
|
|
553
|
+
assert self.m["width"] == "100"
|
|
554
|
+
assert self.m["height"] == "200"
|
|
555
|
+
try:
|
|
556
|
+
self.m.invalid
|
|
557
|
+
except AttributeError:
|
|
558
|
+
pass
|
|
559
|
+
else:
|
|
560
|
+
assert False
|
|
561
|
+
|
|
562
|
+
def test_with_defaults(self):
|
|
563
|
+
orig_req = WMSMapRequestParams(param=dict(layers="baz"))
|
|
564
|
+
new_req = self.m.with_defaults(orig_req)
|
|
565
|
+
assert new_req is not self.m
|
|
566
|
+
assert self.m.get("LayErs") == "bar"
|
|
567
|
+
assert new_req.get("LAyers") == "baz"
|
|
568
|
+
assert new_req.size == (100, 200)
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
class TestURLDecode(object):
|
|
572
|
+
|
|
573
|
+
def test_key_decode(self):
|
|
574
|
+
d = url_decode("white+space=in+key&foo=bar", decode_keys=True)
|
|
575
|
+
assert d["white space"] == "in key"
|
|
576
|
+
assert d["foo"] == "bar"
|
|
577
|
+
|
|
578
|
+
def test_include_empty(self):
|
|
579
|
+
d = url_decode("bar&foo=baz&bing", include_empty=True)
|
|
580
|
+
assert d["bar"] == ""
|
|
581
|
+
assert d["foo"] == "baz"
|
|
582
|
+
assert d["bing"] == ""
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
def test_non_mime_format():
|
|
586
|
+
m = WMSMapRequest(param={"format": "jpeg"})
|
|
587
|
+
assert m.params.format == "jpeg"
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
def test_request_w_url():
|
|
591
|
+
url = WMSMapRequest(
|
|
592
|
+
url="http://localhost:8000/service?", param={"layers": "foo,bar"}
|
|
593
|
+
).complete_url
|
|
594
|
+
assert_url_eq(
|
|
595
|
+
url,
|
|
596
|
+
"http://localhost:8000/service?layers=foo,bar&styles=&request=GetMap&service=WMS",
|
|
597
|
+
)
|
|
598
|
+
url = WMSMapRequest(
|
|
599
|
+
url="http://localhost:8000/service", param={"layers": "foo,bar"}
|
|
600
|
+
).complete_url
|
|
601
|
+
assert_url_eq(
|
|
602
|
+
url,
|
|
603
|
+
"http://localhost:8000/service?layers=foo,bar&styles=&request=GetMap&service=WMS",
|
|
604
|
+
)
|
|
605
|
+
url = WMSMapRequest(
|
|
606
|
+
url="http://localhost:8000/service?map=foo", param={"layers": "foo,bar"}
|
|
607
|
+
).complete_url
|
|
608
|
+
assert_url_eq(
|
|
609
|
+
url,
|
|
610
|
+
"http://localhost:8000/service?map=foo&layers=foo,bar&styles=&request=GetMap&service=WMS",
|
|
611
|
+
)
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
class TestWMSRequest(object):
|
|
615
|
+
env = make_wsgi_env(
|
|
616
|
+
"""LAYERS=foo&FORMAT=image%2Fjpeg&SERVICE=WMS&VERSION=1.1.1&
|
|
617
|
+
REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_xml&SRS=EPSG%3A900913&
|
|
618
|
+
BBOX=8,4,9,5&WIDTH=984&HEIGHT=708""".replace(
|
|
619
|
+
"\n", ""
|
|
620
|
+
)
|
|
621
|
+
)
|
|
622
|
+
|
|
623
|
+
def setup_method(self):
|
|
624
|
+
self.req = Request(self.env)
|
|
625
|
+
|
|
626
|
+
def test_valid_request(self):
|
|
627
|
+
map_req = wms_request(self.req)
|
|
628
|
+
# constructor validates
|
|
629
|
+
assert map_req.params.size == (984, 708)
|
|
630
|
+
|
|
631
|
+
def test_invalid_request(self):
|
|
632
|
+
del self.req.args["request"]
|
|
633
|
+
try:
|
|
634
|
+
wms_request(self.req)
|
|
635
|
+
except RequestError as e:
|
|
636
|
+
assert "request" in e.msg
|
|
637
|
+
else:
|
|
638
|
+
assert False, "RequestError expected"
|
|
639
|
+
|
|
640
|
+
def test_exception_handler(self):
|
|
641
|
+
map_req = wms_request(self.req)
|
|
642
|
+
assert isinstance(map_req.exception_handler, WMS111ExceptionHandler)
|
|
643
|
+
|
|
644
|
+
def test_image_exception_handler(self):
|
|
645
|
+
self.req.args["exceptions"] = "application/vnd.ogc.se_inimage"
|
|
646
|
+
map_req = wms_request(self.req)
|
|
647
|
+
assert isinstance(map_req.exception_handler, WMSImageExceptionHandler)
|
|
648
|
+
|
|
649
|
+
def test_blank_exception_handler(self):
|
|
650
|
+
self.req.args["exceptions"] = "blank"
|
|
651
|
+
map_req = wms_request(self.req)
|
|
652
|
+
assert isinstance(map_req.exception_handler, WMSBlankExceptionHandler)
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
class TestSRSAxisOrder(object):
|
|
656
|
+
|
|
657
|
+
def setup_method(self):
|
|
658
|
+
params111 = url_decode(
|
|
659
|
+
"""LAYERS=foo&FORMAT=image%2Fjpeg&SERVICE=WMS&
|
|
660
|
+
VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_xml&
|
|
661
|
+
SRS=EPSG%3A4326&BBOX=8,4,9,5&WIDTH=984&HEIGHT=708""".replace(
|
|
662
|
+
"\n", ""
|
|
663
|
+
)
|
|
664
|
+
)
|
|
665
|
+
self.req111 = WMS111MapRequest(params111)
|
|
666
|
+
self.params130 = params111.copy()
|
|
667
|
+
self.params130["version"] = "1.3.0"
|
|
668
|
+
self.params130["crs"] = self.params130["srs"]
|
|
669
|
+
del self.params130["srs"]
|
|
670
|
+
|
|
671
|
+
def test_111_order(self):
|
|
672
|
+
assert self.req111.params.bbox == (8, 4, 9, 5)
|
|
673
|
+
|
|
674
|
+
def test_130_order_geog(self):
|
|
675
|
+
req130 = WMS130MapRequest(self.params130)
|
|
676
|
+
assert req130.params.bbox == (4, 8, 5, 9)
|
|
677
|
+
self.params130["crs"] = "EPSG:4258"
|
|
678
|
+
req130 = WMS130MapRequest(self.params130)
|
|
679
|
+
assert req130.params.bbox == (4, 8, 5, 9)
|
|
680
|
+
|
|
681
|
+
def test_130_order_geog_old(self):
|
|
682
|
+
self.params130["crs"] = "CRS:84"
|
|
683
|
+
req130 = WMS130MapRequest(self.params130)
|
|
684
|
+
assert req130.params.bbox == (8, 4, 9, 5)
|
|
685
|
+
|
|
686
|
+
def test_130_order_proj_north_east(self):
|
|
687
|
+
self.params130["crs"] = "EPSG:31466"
|
|
688
|
+
req130 = WMS130MapRequest(self.params130)
|
|
689
|
+
assert req130.params.bbox == (4, 8, 5, 9)
|
|
690
|
+
|
|
691
|
+
def test_130_order_proj(self):
|
|
692
|
+
self.params130["crs"] = "EPSG:31463"
|
|
693
|
+
req130 = WMS130MapRequest(self.params130)
|
|
694
|
+
assert req130.params.bbox == (8, 4, 9, 5)
|
|
695
|
+
|
|
696
|
+
|
|
697
|
+
class TestTileRequest(object):
|
|
698
|
+
|
|
699
|
+
def test_tms_request(self):
|
|
700
|
+
env = {"PATH_INFO": "/tms/1.0.0/osm/5/2/3.png", "QUERY_STRING": ""}
|
|
701
|
+
req = Request(env)
|
|
702
|
+
tms = tile_request(req)
|
|
703
|
+
assert isinstance(tms, TMSRequest)
|
|
704
|
+
assert tms.tile == (2, 3, 5)
|
|
705
|
+
assert tms.format == "png"
|
|
706
|
+
assert tms.layer == "osm"
|
|
707
|
+
assert tms.dimensions == {}
|
|
708
|
+
|
|
709
|
+
def test_tile_request(self):
|
|
710
|
+
env = {"PATH_INFO": "/tiles/1.0.0/osm/5/2/3.png", "QUERY_STRING": ""}
|
|
711
|
+
req = Request(env)
|
|
712
|
+
tile_req = tile_request(req)
|
|
713
|
+
assert isinstance(tile_req, TileRequest)
|
|
714
|
+
assert tile_req.tile == (2, 3, 5)
|
|
715
|
+
assert tile_req.origin is None
|
|
716
|
+
assert tile_req.format == "png"
|
|
717
|
+
assert tile_req.layer == "osm"
|
|
718
|
+
assert tile_req.dimensions == {}
|
|
719
|
+
|
|
720
|
+
def test_tile_request_flipped_y(self):
|
|
721
|
+
env = {"PATH_INFO": "/tiles/1.0.0/osm/5/2/3.png", "QUERY_STRING": "origin=nw"}
|
|
722
|
+
req = Request(env)
|
|
723
|
+
tile_req = tile_request(req)
|
|
724
|
+
assert isinstance(tile_req, TileRequest)
|
|
725
|
+
assert tile_req.tile == (2, 3, 5) # not yet flipped
|
|
726
|
+
assert tile_req.origin == "nw"
|
|
727
|
+
assert tile_req.format == "png"
|
|
728
|
+
assert tile_req.layer == "osm"
|
|
729
|
+
assert tile_req.dimensions == {}
|
|
730
|
+
|
|
731
|
+
def test_tile_request_w_epsg(self):
|
|
732
|
+
env = {"PATH_INFO": "/tiles/1.0.0/osm/EPSG4326/5/2/3.png", "QUERY_STRING": ""}
|
|
733
|
+
req = Request(env)
|
|
734
|
+
tile_req = tile_request(req)
|
|
735
|
+
assert isinstance(tile_req, TileRequest)
|
|
736
|
+
assert tile_req.tile == (2, 3, 5)
|
|
737
|
+
assert tile_req.format == "png"
|
|
738
|
+
assert tile_req.layer == "osm"
|
|
739
|
+
assert tile_req.dimensions == {"_layer_spec": "EPSG4326"}
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
def test_request_params_pickle():
|
|
743
|
+
params = RequestParams(dict(foo="bar", zing="zong"))
|
|
744
|
+
params2 = pickle.loads(pickle.dumps(params, 2))
|
|
745
|
+
assert params.params == params2.params
|