Skip to content
Permalink
Browse files

Add unit test for GetFeatureInfo on raster layer in xml

  • Loading branch information
pblottiere committed Jan 28, 2019
1 parent 45399d7 commit e4cdd7c2544d4dce9de4ca72beedfd1768235f89
Showing with 207 additions and 4 deletions.
  1. +9 −0 tests/src/python/test_qgsserver_wms_getfeatureinfo.py
  2. +198 −4 tests/testdata/qgis_server/test_project.qgs
@@ -213,6 +213,15 @@ def testGetFeatureInfo(self):
'wms_getfeatureinfo-values0-text-xml',
'test_project_values.qgz')

# Test GetFeatureInfo on raster layer
self.wms_request_compare('GetFeatureInfo',
'&layers=landsat&styles=&' +
'info_format=text%2Fxml&transparent=true&' +
'width=500&height=500&srs=EPSG%3A3857&' +
'bbox=1989139.6,3522745.0,2015014.9,3537004.5&' +
'query_layers=landsat&X=250&Y=250',
'wms_getfeatureinfo-raster-text-xml')

def testGetFeatureInfoValueRelation(self):
"""Test GetFeatureInfo resolves "value relation" widget values. regression 18518"""
mypath = self.testdata_path + "test_project_values.qgz"
@@ -22,6 +22,9 @@
<layer-tree-layer checked="Qt::Checked" expanded="1" providerKey="ogr" name="testlayer" source="./testlayer.shp" id="testlayer_c0988fd7_97ca_451d_adbc_37ad6d10583a">
<customproperties/>
</layer-tree-layer>
<layer-tree-layer checked="Qt::Checked" expanded="0" providerKey="gdal" name="landsat" source="../landsat.tif" id="landsat_a7d15b35_ca83_4b23_a9fb_af3fbdd60d15">
<customproperties/>
</layer-tree-layer>
<layer-tree-layer checked="Qt::Checked" expanded="1" providerKey="ogr" name="testlayer èé" source="./testlayer.shp" id="testlayer20150528120452665">
<customproperties/>
</layer-tree-layer>
@@ -54,6 +57,7 @@
<item>testlayer_2b89ed65_ef2f_4897_af15_9b32d4c4e040</item>
<item>testlayer_èé_cf86cf11_222f_4b62_929c_12cfc82b9774</item>
<item>testlayer_èé_2_a5f61891_b949_43e3_ad30_84013fc922de</item>
<item>landsat_a7d15b35_ca83_4b23_a9fb_af3fbdd60d15</item>
</custom-order>
</layer-tree-group>
<snapping-settings mode="1" enabled="0" type="2" tolerance="0" unit="2" intersection-snapping="0">
@@ -70,10 +74,10 @@
<mapcanvas annotationsVisible="1" name="theMapCanvas">
<units>degrees</units>
<extent>
<xmin>8.20313020806923632</xmin>
<ymin>44.90118727027074641</ymin>
<xmax>8.20717330488028196</xmax>
<ymax>44.90224039332306205</ymax>
<xmin>17.92123882869385909</xmin>
<ymin>30.1492204088525888</ymin>
<xmax>18.0486921925404431</xmax>
<ymax>30.25992437587047235</ymax>
</extent>
<rotation>0</rotation>
<destinationsrs>
@@ -97,6 +101,11 @@
<legendlayerfile layerid="testlayer_c0988fd7_97ca_451d_adbc_37ad6d10583a" visible="1" isInOverview="0"/>
</filegroup>
</legendlayer>
<legendlayer drawingOrder="-1" checked="Qt::Checked" name="landsat" showFeatureCount="0" open="false">
<filegroup hidden="false" open="false">
<legendlayerfile layerid="landsat_a7d15b35_ca83_4b23_a9fb_af3fbdd60d15" visible="1" isInOverview="0"/>
</filegroup>
</legendlayer>
<legendlayer drawingOrder="-1" checked="Qt::Checked" name="testlayer èé" showFeatureCount="0" open="true">
<filegroup hidden="false" open="true">
<legendlayerfile layerid="testlayer20150528120452665" visible="1" isInOverview="0"/>
@@ -128,7 +137,191 @@
</legendgroup>
</legend>
<mapViewDocks/>
<mapcanvas annotationsVisible="1" name="mAreaCanvas">
<units>degrees</units>
<extent>
<xmin>0</xmin>
<ymin>0</ymin>
<xmax>0</xmax>
<ymax>0</ymax>
</extent>
<rotation>0</rotation>
<destinationsrs>
<spatialrefsys>
<proj4>+proj=longlat +datum=WGS84 +no_defs</proj4>
<srsid>3452</srsid>
<srid>4326</srid>
<authid>EPSG:4326</authid>
<description>WGS 84</description>
<projectionacronym>longlat</projectionacronym>
<ellipsoidacronym>WGS84</ellipsoidacronym>
<geographicflag>true</geographicflag>
</spatialrefsys>
</destinationsrs>
<rendermaptile>0</rendermaptile>
</mapcanvas>
<mapcanvas annotationsVisible="1" name="mAreaCanvas">
<units>degrees</units>
<extent>
<xmin>0</xmin>
<ymin>0</ymin>
<xmax>0</xmax>
<ymax>0</ymax>
</extent>
<rotation>0</rotation>
<destinationsrs>
<spatialrefsys>
<proj4>+proj=longlat +datum=WGS84 +no_defs</proj4>
<srsid>3452</srsid>
<srid>4326</srid>
<authid>EPSG:4326</authid>
<description>WGS 84</description>
<projectionacronym>longlat</projectionacronym>
<ellipsoidacronym>WGS84</ellipsoidacronym>
<geographicflag>true</geographicflag>
</spatialrefsys>
</destinationsrs>
<rendermaptile>0</rendermaptile>
</mapcanvas>
<mapcanvas annotationsVisible="1" name="mAreaCanvas">
<units>degrees</units>
<extent>
<xmin>0</xmin>
<ymin>0</ymin>
<xmax>0</xmax>
<ymax>0</ymax>
</extent>
<rotation>0</rotation>
<destinationsrs>
<spatialrefsys>
<proj4>+proj=longlat +datum=WGS84 +no_defs</proj4>
<srsid>3452</srsid>
<srid>4326</srid>
<authid>EPSG:4326</authid>
<description>WGS 84</description>
<projectionacronym>longlat</projectionacronym>
<ellipsoidacronym>WGS84</ellipsoidacronym>
<geographicflag>true</geographicflag>
</spatialrefsys>
</destinationsrs>
<rendermaptile>0</rendermaptile>
</mapcanvas>
<projectlayers>
<maplayer refreshOnNotifyEnabled="0" maxScale="0" refreshOnNotifyMessage="" type="raster" minScale="1e+8" styleCategories="AllStyleCategories" autoRefreshEnabled="0" hasScaleBasedVisibilityFlag="0" autoRefreshTime="0">
<extent>
<xmin>781662.375</xmin>
<ymin>3339523.125</ymin>
<xmax>793062.375</xmax>
<ymax>3350923.125</ymax>
</extent>
<id>landsat_a7d15b35_ca83_4b23_a9fb_af3fbdd60d15</id>
<datasource>../landsat.tif</datasource>
<keywordList>
<value></value>
</keywordList>
<layername>landsat</layername>
<srs>
<spatialrefsys>
<proj4>+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs</proj4>
<srsid>3117</srsid>
<srid>32633</srid>
<authid>EPSG:32633</authid>
<description>WGS 84 / UTM zone 33N</description>
<projectionacronym>utm</projectionacronym>
<ellipsoidacronym>WGS84</ellipsoidacronym>
<geographicflag>false</geographicflag>
</spatialrefsys>
</srs>
<resourceMetadata>
<identifier></identifier>
<parentidentifier></parentidentifier>
<language></language>
<type></type>
<title></title>
<abstract></abstract>
<contact>
<name></name>
<organization></organization>
<position></position>
<voice></voice>
<fax></fax>
<email></email>
<role></role>
</contact>
<links/>
<fees></fees>
<encoding></encoding>
<crs>
<spatialrefsys>
<proj4></proj4>
<srsid>0</srsid>
<srid>0</srid>
<authid></authid>
<description></description>
<projectionacronym></projectionacronym>
<ellipsoidacronym></ellipsoidacronym>
<geographicflag>false</geographicflag>
</spatialrefsys>
</crs>
<extent>
<spatial miny="0" crs="" minz="0" minx="0" maxx="0" dimensions="2" maxy="0" maxz="0"/>
<temporal>
<period>
<start></start>
<end></end>
</period>
</temporal>
</extent>
</resourceMetadata>
<provider>gdal</provider>
<noData>
<noDataList bandNo="1" useSrcNoData="0"/>
<noDataList bandNo="2" useSrcNoData="0"/>
<noDataList bandNo="3" useSrcNoData="0"/>
<noDataList bandNo="4" useSrcNoData="0"/>
<noDataList bandNo="5" useSrcNoData="0"/>
<noDataList bandNo="6" useSrcNoData="0"/>
<noDataList bandNo="7" useSrcNoData="0"/>
<noDataList bandNo="8" useSrcNoData="0"/>
<noDataList bandNo="9" useSrcNoData="0"/>
</noData>
<map-layer-style-manager current="default">
<map-layer-style name="default"/>
</map-layer-style-manager>
<flags>
<Identifiable>1</Identifiable>
<Removable>1</Removable>
<Searchable>1</Searchable>
</flags>
<customproperties>
<property value="false" key="WMSBackgroundLayer"/>
<property value="false" key="WMSPublishDataSourceUrl"/>
<property value="0" key="embeddedWidgets/count"/>
<property value="Value" key="identify/format"/>
</customproperties>
<pipe>
<rasterrenderer opacity="1" type="singlebandgray" grayBand="1" gradient="BlackToWhite" alphaBand="-1">
<rasterTransparency/>
<minMaxOrigin>
<limits>MinMax</limits>
<extent>WholeRaster</extent>
<statAccuracy>Estimated</statAccuracy>
<cumulativeCutLower>0.02</cumulativeCutLower>
<cumulativeCutUpper>0.98</cumulativeCutUpper>
<stdDevFactor>2</stdDevFactor>
</minMaxOrigin>
<contrastEnhancement>
<minValue>122</minValue>
<maxValue>130</maxValue>
<algorithm>StretchToMinimumMaximum</algorithm>
</contrastEnhancement>
</rasterrenderer>
<brightnesscontrast contrast="0" brightness="0"/>
<huesaturation saturation="0" colorizeOn="0" grayscaleMode="0" colorizeGreen="128" colorizeStrength="100" colorizeBlue="128" colorizeRed="255"/>
<rasterresampler maxOversampling="2"/>
</pipe>
<blendMode>0</blendMode>
</maplayer>
<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">
<extent>
<xmin>8.20345930703634352</xmin>
@@ -1540,6 +1733,7 @@ def my_form_open(dialog, layer, feature):
<layer id="testlayer_2b89ed65_ef2f_4897_af15_9b32d4c4e040"/>
<layer id="testlayer_èé_cf86cf11_222f_4b62_929c_12cfc82b9774"/>
<layer id="testlayer_èé_2_a5f61891_b949_43e3_ad30_84013fc922de"/>
<layer id="landsat_a7d15b35_ca83_4b23_a9fb_af3fbdd60d15"/>
</layerorder>
<properties>
<WMSAccessConstraints type="QString">None</WMSAccessConstraints>

0 comments on commit e4cdd7c

Please sign in to comment.
You can’t perform that action at this time.