Debian Codegraph @

tests/_broken/doctests_py3/wmts_geoserver21.txt

raw
1
2 Imports
3
4 >>> from tests.utils import cast_tuple_int_list, resource_file
5 >>> from owslib.wmts import WebMapTileService
6
7 Fake a request to a WMTS Server using saved doc from
8 http://geonode.iwlearn.org/geoserver/gwc/service/wmts?REQUEST=GetCapabilities
9
10 >>> xml = open(resource_file('geoserver21-wmts-cap.xml'), 'rb').read()
11 >>> wmts = WebMapTileService('url', version='1.0.0', xml=xml)
12
13 Test capabilities
14 -----------------
15 >>> wmts.identification.type
16 'OGC WMTS'
17 >>> wmts.identification.version
18 '1.0.0'
19 >>> wmts.identification.title
20 'Web Map Tile Service - GeoWebCache'
21 >>> wmts.identification.abstract
22
23 >>> wmts.identification.keywords
24 []
25 >>> wmts.identification.accessconstraints
26
27 >>> wmts.identification.fees
28
29 >>> wmts.restonly
30 False
31
32 Service Provider:
33
34 >>> wmts.provider.name
35 'http://geonode.iwlearn.org/geoserver/gwc/service/wmts'
36 >>> wmts.provider.url
37 'http://geonode.iwlearn.org/geoserver/gwc/service/wmts'
38
39 Check contact info
40 >>> wmts.provider.contact.name
41 'GeoWebCache User'
42 >>> wmts.provider.contact.position
43
44
45 Test available content layers
46 >>> sorted(list(wmts.contents))
47 ['geonode:Basins', 'geonode:ContinentalMargins', 'geonode:Diktas_Project_Area_1', 'geonode:FEOWv1_TNC', 'geonode:GH_Anidamiento_de_Tortugas_Marinas4326', 'geonode:GH_Anidamiento_de_aves4326', 'geonode:GH_Areas_Protegidas4326', 'geonode:GH_Arrecifes_Coralinos4326', 'geonode:GH_Blanqueamiento_Corales4326', 'geonode:GH_Departamentos4326', 'geonode:GH_Descargas4326', 'geonode:GH_Descargas_2007_4326', 'geonode:GH_Desove_Peces4326', 'geonode:GH_Distribucion_de_Manati4326', 'geonode:GH_Est_muestreo4326', 'geonode:GH_Est_muestreo_propuestas4326', 'geonode:GH_Estuarios_y_Lagunas4326', 'geonode:GH_Limites_Administrativos_Pol4326', 'geonode:GH_Manglares4326', 'geonode:GH_Otras_enfermedades_Corales4326', 'geonode:GH_Paises_Pol4326', 'geonode:GH_Paises_Region_Pol4326', 'geonode:GH_Pastos_Marinos4326', 'geonode:GH_Playas_arenosas4326', 'geonode:GH_Sitios_Prioritarios_TNC4326', 'geonode:GH_Usos_suelo_SOTERLAC4326', 'geonode:GH_ecosistemas_terrestres4326', 'geonode:GIS_OTHER_VEC_CASP_OIL_PNT', 'geonode:GIS_OTHER_VEC_CASP_PIPELIN', 'geonode:GIS_OTHER_VEC_ISOLINES', 'geonode:LMEs_64', 'geonode:Longhurst_world_v4_2010', 'geonode:MANGROVES', 'geonode:SEAGRASSES', 'geonode:TB_Aquifers_New', 'geonode:World_Fao_Zones', 'geonode:World_Maritime_Boundaries_v6_1_20110512', 'geonode:World_Seas', 'geonode:XYDjibouti', 'geonode:XYSudan', 'geonode:XYYemen', 'geonode:abc1', 'geonode:abril', 'geonode:area_de_estudio_1', 'geonode:asfalto', 'geonode:bcp_wgs84_0511', 'geonode:giwa_lme', 'geonode:glwd_1', 'geonode:hotspots_revisited_2004_polygons', 'geonode:igrac_tba_WL_201105_projected', 'geonode:mapa_geologico4326', 'geonode:mapa_geologico_fallas4326', 'geonode:mapa_geologico_provincias4326', 'geonode:meow_ecos', 'geonode:red_hidrografica', 'geonode:seaVoX_sea_area_polygons', 'geonode:undersea_features_2008', 'geonode:wribasin']
48
49 Test TileMatrixSet variants
50 >>> sorted(wmts.tilematrixsets.keys())
51 ['EPSG:4326', 'EPSG:900913', 'GlobalCRS84Pixel', 'GlobalCRS84Scale', 'GoogleCRS84Quad', 'GoogleMapsCompatible']
52 >>> wmts.tilematrixsets['GoogleMapsCompatible'].identifier
53 'GoogleMapsCompatible'
54 >>> wmts.tilematrixsets['GoogleMapsCompatible'].crs
55 'urn:ogc:def:crs:EPSG::900913'
56 >>> sorted(wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix.keys())
57 ['GoogleMapsCompatible:0', 'GoogleMapsCompatible:1', 'GoogleMapsCompatible:10', 'GoogleMapsCompatible:11', 'GoogleMapsCompatible:12', 'GoogleMapsCompatible:13', 'GoogleMapsCompatible:14', 'GoogleMapsCompatible:15', 'GoogleMapsCompatible:16', 'GoogleMapsCompatible:17', 'GoogleMapsCompatible:18', 'GoogleMapsCompatible:19', 'GoogleMapsCompatible:2', 'GoogleMapsCompatible:20', 'GoogleMapsCompatible:3', 'GoogleMapsCompatible:4', 'GoogleMapsCompatible:5', 'GoogleMapsCompatible:6', 'GoogleMapsCompatible:7', 'GoogleMapsCompatible:8', 'GoogleMapsCompatible:9']
58 >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['GoogleMapsCompatible:0'].identifier
59 'GoogleMapsCompatible:0'
60 >>> int(wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['GoogleMapsCompatible:0'].scaledenominator)
61 559082264
62 >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['GoogleMapsCompatible:0'].topleftcorner
63 (-20037508.34, 20037508.0)
64 >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['GoogleMapsCompatible:0'].tilewidth
65 256
66 >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['GoogleMapsCompatible:0'].tileheight
67 256
68 >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['GoogleMapsCompatible:0'].matrixwidth
69 1
70 >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['GoogleMapsCompatible:0'].matrixheight
71 1
72 >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['GoogleMapsCompatible:17'].identifier
73 'GoogleMapsCompatible:17'
74 >>> int(wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['GoogleMapsCompatible:17'].scaledenominator)
75 4265
76 >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['GoogleMapsCompatible:17'].topleftcorner
77 (-20037508.34, 20037508.0)
78 >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['GoogleMapsCompatible:17'].tilewidth
79 256
80 >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['GoogleMapsCompatible:17'].tileheight
81 256
82 >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['GoogleMapsCompatible:17'].matrixwidth
83 131072
84 >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['GoogleMapsCompatible:17'].matrixheight
85 131072
86
87 >>> wmts.tilematrixsets['GlobalCRS84Scale'].identifier
88 'GlobalCRS84Scale'
89 >>> wmts.tilematrixsets['GlobalCRS84Scale'].crs
90 'urn:ogc:def:crs:EPSG::4326'
91 >>> sorted(wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix.keys())
92 ['GlobalCRS84Scale:0', 'GlobalCRS84Scale:1', 'GlobalCRS84Scale:10', 'GlobalCRS84Scale:11', 'GlobalCRS84Scale:12', 'GlobalCRS84Scale:13', 'GlobalCRS84Scale:14', 'GlobalCRS84Scale:15', 'GlobalCRS84Scale:16', 'GlobalCRS84Scale:17', 'GlobalCRS84Scale:18', 'GlobalCRS84Scale:19', 'GlobalCRS84Scale:2', 'GlobalCRS84Scale:20', 'GlobalCRS84Scale:3', 'GlobalCRS84Scale:4', 'GlobalCRS84Scale:5', 'GlobalCRS84Scale:6', 'GlobalCRS84Scale:7', 'GlobalCRS84Scale:8', 'GlobalCRS84Scale:9']
93 >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['GlobalCRS84Scale:0'].identifier
94 'GlobalCRS84Scale:0'
95 >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['GlobalCRS84Scale:0'].scaledenominator
96 500000000.0
97 >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['GlobalCRS84Scale:0'].topleftcorner
98 (90.0, -180.0)
99 >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['GlobalCRS84Scale:0'].tilewidth
100 256
101 >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['GlobalCRS84Scale:0'].tileheight
102 256
103 >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['GlobalCRS84Scale:0'].matrixwidth
104 2
105 >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['GlobalCRS84Scale:0'].matrixheight
106 1
107 >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['GlobalCRS84Scale:20'].identifier
108 'GlobalCRS84Scale:20'
109 >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['GlobalCRS84Scale:20'].scaledenominator
110 100.0
111 >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['GlobalCRS84Scale:20'].topleftcorner
112 (90.0, -180.0)
113 >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['GlobalCRS84Scale:20'].tilewidth
114 256
115 >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['GlobalCRS84Scale:20'].tileheight
116 256
117 >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['GlobalCRS84Scale:20'].matrixwidth
118 5590823
119 >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['GlobalCRS84Scale:20'].matrixheight
120 2795412
121
122 Test single item accessor
123
124 >>> wmts['geonode:GH_Areas_Protegidas4326'].title
125 'GOH Areas Protegidas'
126 >>> cast_tuple_int_list(wmts['geonode:GH_Areas_Protegidas4326'].boundingBoxWGS84)
127 [-92, 12, -84, 18]
128 >>> wmts['geonode:GH_Areas_Protegidas4326'].id
129 'geonode:GH_Areas_Protegidas4326'
130 >>> wmts['geonode:GH_Areas_Protegidas4326'].styles
131 {'GH_Areas_Protegidas4326': {'isDefault': True}}
132 >>> wmts['geonode:GH_Areas_Protegidas4326'].formats
133 ['image/png', 'image/jpeg']
134 >>> sorted(wmts['geonode:GH_Areas_Protegidas4326'].tilematrixsets)
135 ['EPSG:4326', 'EPSG:900913']
136 >>> sorted(wmts['geonode:GH_Areas_Protegidas4326'].tilematrixsetlinks.keys())
137 ['EPSG:4326', 'EPSG:900913']
138 >>> wmts['geonode:GH_Areas_Protegidas4326'].tilematrixsetlinks['EPSG:4326']
139 <TileMatrixSetLink: EPSG:4326, tilematrixlimits={...}>
140 >>> sorted(wmts['geonode:GH_Areas_Protegidas4326'].tilematrixsetlinks['EPSG:4326'].tilematrixlimits.keys())
141 ['EPSG:4326:0', 'EPSG:4326:1', 'EPSG:4326:10', 'EPSG:4326:11', 'EPSG:4326:12', 'EPSG:4326:13', 'EPSG:4326:14', 'EPSG:4326:15', 'EPSG:4326:16', 'EPSG:4326:17', 'EPSG:4326:18', 'EPSG:4326:19', 'EPSG:4326:2', 'EPSG:4326:20', 'EPSG:4326:3', 'EPSG:4326:4', 'EPSG:4326:5', 'EPSG:4326:6', 'EPSG:4326:7', 'EPSG:4326:8', 'EPSG:4326:9', 'null']
142 >>> wmts['geonode:GH_Areas_Protegidas4326'].tilematrixsetlinks['EPSG:4326'].tilematrixlimits['EPSG:4326:14']
143 <TileMatrixLimits: EPSG:4326:14, minRow=6510, maxRow=7010, minCol=7994, maxCol=8713>
144 >>> wmts['geonode:GH_Areas_Protegidas4326'].infoformats
145 ['text/plain', 'text/html', 'application/vnd.ogc.gml']
146 >>> wmts['geonode:GH_Areas_Protegidas4326'].resourceURLs
147 []
148
149 Test several layers styles
150 >>> wmts.contents['geonode:MANGROVES'].styles
151 {'MANGROVES': {'isDefault': True}}
152 >>> wmts.contents['geonode:asfalto'].styles
153 {'asfalto': {'format': 'image/png', 'legend': 'http://www.maps.bob/etopo2/legend.png', 'isDefault': True, 'title': 'TEST Title: hotspots revisited 2004 polygons'}}
154 >>> wmts.contents['geonode:hotspots_revisited_2004_polygons'].styles
155 {'hotspots_revisited_2004_polygons': {'title': 'TEST Title: hotspots revisited 2004 polygons', 'abstract': 'TEST Abstract: hotspots revisited 2004 polygons', 'format': 'image/png', 'height': '100', 'width': '100', 'keywords': ['testkeywords1', 'test keywords 2', 'test keywords 3'], 'legend': 'http://www.maps.bob/etopo2/legend.png', 'isDefault': True}}
156 >>> wmts.contents['geonode:asfalto'].styles
157 {'asfalto': {'format': 'image/png', 'legend': 'http://www.maps.bob/etopo2/legend.png', 'isDefault': True, 'title': 'TEST Title: hotspots revisited 2004 polygons'}}
158
159 Test operations
160 # TODO
161
162 Test the gettile methods
163 # TODO