Skip to content

Commit e4cdd7c

Browse files
committedJan 28, 2019
Add unit test for GetFeatureInfo on raster layer in xml
1 parent 45399d7 commit e4cdd7c

File tree

2 files changed

+207
-4
lines changed

2 files changed

+207
-4
lines changed
 

‎tests/src/python/test_qgsserver_wms_getfeatureinfo.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,15 @@ def testGetFeatureInfo(self):
213213
'wms_getfeatureinfo-values0-text-xml',
214214
'test_project_values.qgz')
215215

216+
# Test GetFeatureInfo on raster layer
217+
self.wms_request_compare('GetFeatureInfo',
218+
'&layers=landsat&styles=&' +
219+
'info_format=text%2Fxml&transparent=true&' +
220+
'width=500&height=500&srs=EPSG%3A3857&' +
221+
'bbox=1989139.6,3522745.0,2015014.9,3537004.5&' +
222+
'query_layers=landsat&X=250&Y=250',
223+
'wms_getfeatureinfo-raster-text-xml')
224+
216225
def testGetFeatureInfoValueRelation(self):
217226
"""Test GetFeatureInfo resolves "value relation" widget values. regression 18518"""
218227
mypath = self.testdata_path + "test_project_values.qgz"

‎tests/testdata/qgis_server/test_project.qgs

Lines changed: 198 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
<layer-tree-layer checked="Qt::Checked" expanded="1" providerKey="ogr" name="testlayer" source="./testlayer.shp" id="testlayer_c0988fd7_97ca_451d_adbc_37ad6d10583a">
2323
<customproperties/>
2424
</layer-tree-layer>
25+
<layer-tree-layer checked="Qt::Checked" expanded="0" providerKey="gdal" name="landsat" source="../landsat.tif" id="landsat_a7d15b35_ca83_4b23_a9fb_af3fbdd60d15">
26+
<customproperties/>
27+
</layer-tree-layer>
2528
<layer-tree-layer checked="Qt::Checked" expanded="1" providerKey="ogr" name="testlayer èé" source="./testlayer.shp" id="testlayer20150528120452665">
2629
<customproperties/>
2730
</layer-tree-layer>
@@ -54,6 +57,7 @@
5457
<item>testlayer_2b89ed65_ef2f_4897_af15_9b32d4c4e040</item>
5558
<item>testlayer_èé_cf86cf11_222f_4b62_929c_12cfc82b9774</item>
5659
<item>testlayer_èé_2_a5f61891_b949_43e3_ad30_84013fc922de</item>
60+
<item>landsat_a7d15b35_ca83_4b23_a9fb_af3fbdd60d15</item>
5761
</custom-order>
5862
</layer-tree-group>
5963
<snapping-settings mode="1" enabled="0" type="2" tolerance="0" unit="2" intersection-snapping="0">
@@ -70,10 +74,10 @@
7074
<mapcanvas annotationsVisible="1" name="theMapCanvas">
7175
<units>degrees</units>
7276
<extent>
73-
<xmin>8.20313020806923632</xmin>
74-
<ymin>44.90118727027074641</ymin>
75-
<xmax>8.20717330488028196</xmax>
76-
<ymax>44.90224039332306205</ymax>
77+
<xmin>17.92123882869385909</xmin>
78+
<ymin>30.1492204088525888</ymin>
79+
<xmax>18.0486921925404431</xmax>
80+
<ymax>30.25992437587047235</ymax>
7781
</extent>
7882
<rotation>0</rotation>
7983
<destinationsrs>
@@ -97,6 +101,11 @@
97101
<legendlayerfile layerid="testlayer_c0988fd7_97ca_451d_adbc_37ad6d10583a" visible="1" isInOverview="0"/>
98102
</filegroup>
99103
</legendlayer>
104+
<legendlayer drawingOrder="-1" checked="Qt::Checked" name="landsat" showFeatureCount="0" open="false">
105+
<filegroup hidden="false" open="false">
106+
<legendlayerfile layerid="landsat_a7d15b35_ca83_4b23_a9fb_af3fbdd60d15" visible="1" isInOverview="0"/>
107+
</filegroup>
108+
</legendlayer>
100109
<legendlayer drawingOrder="-1" checked="Qt::Checked" name="testlayer èé" showFeatureCount="0" open="true">
101110
<filegroup hidden="false" open="true">
102111
<legendlayerfile layerid="testlayer20150528120452665" visible="1" isInOverview="0"/>
@@ -128,7 +137,191 @@
128137
</legendgroup>
129138
</legend>
130139
<mapViewDocks/>
140+
<mapcanvas annotationsVisible="1" name="mAreaCanvas">
141+
<units>degrees</units>
142+
<extent>
143+
<xmin>0</xmin>
144+
<ymin>0</ymin>
145+
<xmax>0</xmax>
146+
<ymax>0</ymax>
147+
</extent>
148+
<rotation>0</rotation>
149+
<destinationsrs>
150+
<spatialrefsys>
151+
<proj4>+proj=longlat +datum=WGS84 +no_defs</proj4>
152+
<srsid>3452</srsid>
153+
<srid>4326</srid>
154+
<authid>EPSG:4326</authid>
155+
<description>WGS 84</description>
156+
<projectionacronym>longlat</projectionacronym>
157+
<ellipsoidacronym>WGS84</ellipsoidacronym>
158+
<geographicflag>true</geographicflag>
159+
</spatialrefsys>
160+
</destinationsrs>
161+
<rendermaptile>0</rendermaptile>
162+
</mapcanvas>
163+
<mapcanvas annotationsVisible="1" name="mAreaCanvas">
164+
<units>degrees</units>
165+
<extent>
166+
<xmin>0</xmin>
167+
<ymin>0</ymin>
168+
<xmax>0</xmax>
169+
<ymax>0</ymax>
170+
</extent>
171+
<rotation>0</rotation>
172+
<destinationsrs>
173+
<spatialrefsys>
174+
<proj4>+proj=longlat +datum=WGS84 +no_defs</proj4>
175+
<srsid>3452</srsid>
176+
<srid>4326</srid>
177+
<authid>EPSG:4326</authid>
178+
<description>WGS 84</description>
179+
<projectionacronym>longlat</projectionacronym>
180+
<ellipsoidacronym>WGS84</ellipsoidacronym>
181+
<geographicflag>true</geographicflag>
182+
</spatialrefsys>
183+
</destinationsrs>
184+
<rendermaptile>0</rendermaptile>
185+
</mapcanvas>
186+
<mapcanvas annotationsVisible="1" name="mAreaCanvas">
187+
<units>degrees</units>
188+
<extent>
189+
<xmin>0</xmin>
190+
<ymin>0</ymin>
191+
<xmax>0</xmax>
192+
<ymax>0</ymax>
193+
</extent>
194+
<rotation>0</rotation>
195+
<destinationsrs>
196+
<spatialrefsys>
197+
<proj4>+proj=longlat +datum=WGS84 +no_defs</proj4>
198+
<srsid>3452</srsid>
199+
<srid>4326</srid>
200+
<authid>EPSG:4326</authid>
201+
<description>WGS 84</description>
202+
<projectionacronym>longlat</projectionacronym>
203+
<ellipsoidacronym>WGS84</ellipsoidacronym>
204+
<geographicflag>true</geographicflag>
205+
</spatialrefsys>
206+
</destinationsrs>
207+
<rendermaptile>0</rendermaptile>
208+
</mapcanvas>
131209
<projectlayers>
210+
<maplayer refreshOnNotifyEnabled="0" maxScale="0" refreshOnNotifyMessage="" type="raster" minScale="1e+8" styleCategories="AllStyleCategories" autoRefreshEnabled="0" hasScaleBasedVisibilityFlag="0" autoRefreshTime="0">
211+
<extent>
212+
<xmin>781662.375</xmin>
213+
<ymin>3339523.125</ymin>
214+
<xmax>793062.375</xmax>
215+
<ymax>3350923.125</ymax>
216+
</extent>
217+
<id>landsat_a7d15b35_ca83_4b23_a9fb_af3fbdd60d15</id>
218+
<datasource>../landsat.tif</datasource>
219+
<keywordList>
220+
<value></value>
221+
</keywordList>
222+
<layername>landsat</layername>
223+
<srs>
224+
<spatialrefsys>
225+
<proj4>+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs</proj4>
226+
<srsid>3117</srsid>
227+
<srid>32633</srid>
228+
<authid>EPSG:32633</authid>
229+
<description>WGS 84 / UTM zone 33N</description>
230+
<projectionacronym>utm</projectionacronym>
231+
<ellipsoidacronym>WGS84</ellipsoidacronym>
232+
<geographicflag>false</geographicflag>
233+
</spatialrefsys>
234+
</srs>
235+
<resourceMetadata>
236+
<identifier></identifier>
237+
<parentidentifier></parentidentifier>
238+
<language></language>
239+
<type></type>
240+
<title></title>
241+
<abstract></abstract>
242+
<contact>
243+
<name></name>
244+
<organization></organization>
245+
<position></position>
246+
<voice></voice>
247+
<fax></fax>
248+
<email></email>
249+
<role></role>
250+
</contact>
251+
<links/>
252+
<fees></fees>
253+
<encoding></encoding>
254+
<crs>
255+
<spatialrefsys>
256+
<proj4></proj4>
257+
<srsid>0</srsid>
258+
<srid>0</srid>
259+
<authid></authid>
260+
<description></description>
261+
<projectionacronym></projectionacronym>
262+
<ellipsoidacronym></ellipsoidacronym>
263+
<geographicflag>false</geographicflag>
264+
</spatialrefsys>
265+
</crs>
266+
<extent>
267+
<spatial miny="0" crs="" minz="0" minx="0" maxx="0" dimensions="2" maxy="0" maxz="0"/>
268+
<temporal>
269+
<period>
270+
<start></start>
271+
<end></end>
272+
</period>
273+
</temporal>
274+
</extent>
275+
</resourceMetadata>
276+
<provider>gdal</provider>
277+
<noData>
278+
<noDataList bandNo="1" useSrcNoData="0"/>
279+
<noDataList bandNo="2" useSrcNoData="0"/>
280+
<noDataList bandNo="3" useSrcNoData="0"/>
281+
<noDataList bandNo="4" useSrcNoData="0"/>
282+
<noDataList bandNo="5" useSrcNoData="0"/>
283+
<noDataList bandNo="6" useSrcNoData="0"/>
284+
<noDataList bandNo="7" useSrcNoData="0"/>
285+
<noDataList bandNo="8" useSrcNoData="0"/>
286+
<noDataList bandNo="9" useSrcNoData="0"/>
287+
</noData>
288+
<map-layer-style-manager current="default">
289+
<map-layer-style name="default"/>
290+
</map-layer-style-manager>
291+
<flags>
292+
<Identifiable>1</Identifiable>
293+
<Removable>1</Removable>
294+
<Searchable>1</Searchable>
295+
</flags>
296+
<customproperties>
297+
<property value="false" key="WMSBackgroundLayer"/>
298+
<property value="false" key="WMSPublishDataSourceUrl"/>
299+
<property value="0" key="embeddedWidgets/count"/>
300+
<property value="Value" key="identify/format"/>
301+
</customproperties>
302+
<pipe>
303+
<rasterrenderer opacity="1" type="singlebandgray" grayBand="1" gradient="BlackToWhite" alphaBand="-1">
304+
<rasterTransparency/>
305+
<minMaxOrigin>
306+
<limits>MinMax</limits>
307+
<extent>WholeRaster</extent>
308+
<statAccuracy>Estimated</statAccuracy>
309+
<cumulativeCutLower>0.02</cumulativeCutLower>
310+
<cumulativeCutUpper>0.98</cumulativeCutUpper>
311+
<stdDevFactor>2</stdDevFactor>
312+
</minMaxOrigin>
313+
<contrastEnhancement>
314+
<minValue>122</minValue>
315+
<maxValue>130</maxValue>
316+
<algorithm>StretchToMinimumMaximum</algorithm>
317+
</contrastEnhancement>
318+
</rasterrenderer>
319+
<brightnesscontrast contrast="0" brightness="0"/>
320+
<huesaturation saturation="0" colorizeOn="0" grayscaleMode="0" colorizeGreen="128" colorizeStrength="100" colorizeBlue="128" colorizeRed="255"/>
321+
<rasterresampler maxOversampling="2"/>
322+
</pipe>
323+
<blendMode>0</blendMode>
324+
</maplayer>
132325
<maplayer refreshOnNotifyEnabled="0" maxScale="-4.65661e-10" refreshOnNotifyMessage="" type="vector" minScale="1e+8" labelsEnabled="1" readOnly="0" simplifyMaxScale="1" simplifyDrawingTol="1" styleCategories="AllStyleCategories" geometry="Point" simplifyDrawingHints="0" autoRefreshEnabled="0" hasScaleBasedVisibilityFlag="0" simplifyAlgorithm="0" simplifyLocal="1" autoRefreshTime="0">
133326
<extent>
134327
<xmin>8.20345930703634352</xmin>
@@ -1540,6 +1733,7 @@ def my_form_open(dialog, layer, feature):
15401733
<layer id="testlayer_2b89ed65_ef2f_4897_af15_9b32d4c4e040"/>
15411734
<layer id="testlayer_èé_cf86cf11_222f_4b62_929c_12cfc82b9774"/>
15421735
<layer id="testlayer_èé_2_a5f61891_b949_43e3_ad30_84013fc922de"/>
1736+
<layer id="landsat_a7d15b35_ca83_4b23_a9fb_af3fbdd60d15"/>
15431737
</layerorder>
15441738
<properties>
15451739
<WMSAccessConstraints type="QString">None</WMSAccessConstraints>

0 commit comments

Comments
 (0)
Please sign in to comment.