diff --git a/doc/en/user/source/services/wms/img/service_WMS_disableFeaturesReprojection.png b/doc/en/user/source/services/wms/img/service_WMS_disableFeaturesReprojection.png new file mode 100644 index 00000000000..3f2965dc88a Binary files /dev/null and b/doc/en/user/source/services/wms/img/service_WMS_disableFeaturesReprojection.png differ diff --git a/doc/en/user/source/services/wms/webadmin.rst b/doc/en/user/source/services/wms/webadmin.rst index e2870c7913b..74fa84690df 100644 --- a/doc/en/user/source/services/wms/webadmin.rst +++ b/doc/en/user/source/services/wms/webadmin.rst @@ -126,8 +126,12 @@ The usage of dynamic styling can be restricted on a global or per virtual servic .. figure:: img/service_WMS_disableDynamicStyling.png When the flag is checked, a GetMap/GetFeatureInfo request with a dynamic style will result in a service exception reporting the error. + +Disabling GetFeatureInfo requests results reprojection +------------------------------------------------------ + +By default GetFeatureInfo results are reproject to the map coordinate reference system. This behavior can be deactivated on a global or per virtual service basis in the **GetFeatureInfo results reprojection** section. + +.. figure:: img/service_WMS_disableFeaturesReprojection.png - - - - +When the flag is checked, GetFeatureInfo requests results will not be reprojected and will instead used the layer coordinate reference system. diff --git a/src/extension/app-schema/app-schema-test/src/test/java/org/geoserver/test/WmsGetFeatureInfoTest.java b/src/extension/app-schema/app-schema-test/src/test/java/org/geoserver/test/WmsGetFeatureInfoTest.java index 86447d0fcd4..bed66f6e4b9 100755 --- a/src/extension/app-schema/app-schema-test/src/test/java/org/geoserver/test/WmsGetFeatureInfoTest.java +++ b/src/extension/app-schema/app-schema-test/src/test/java/org/geoserver/test/WmsGetFeatureInfoTest.java @@ -7,6 +7,8 @@ import static org.junit.Assert.*; +import org.geoserver.wms.WMSInfo; +import org.junit.Before; import org.junit.Test; import org.geoserver.test.NamespaceTestData; @@ -18,6 +20,14 @@ public WmsGetFeatureInfoTest() throws Exception { super(); } + @Before + public void setupAdvancedProjectionHandling() { + // make sure GetFeatureInfo is not deactivated (this will only update the global service) + WMSInfo wms = getGeoServer().getService(WMSInfo.class); + wms.setFeaturesReprojectionDisabled(false); + getGeoServer().save(wms); + } + @Override protected WmsSupportMockData createTestData() { WmsSupportMockData mockData = new WmsSupportMockData(); @@ -69,7 +79,21 @@ public void testGetFeatureInfoGMLReprojection() throws Exception { "gu.25678", "/wfs:FeatureCollection/gml:featureMember/gsml:MappedFeature/gsml:specification/gsml:GeologicUnit/@gml:id", doc); + // check that features coordinates where reprojected to EPSG:3857 + assertXpathMatches(".*3857", + "/wfs:FeatureCollection/gml:featureMember/gsml:MappedFeature[@gml:id='mf2']/gsml:shape/gml:Polygon/@srsName", + doc); validateGet(request); + // disable features reprojection + WMSInfo wms = getGeoServer().getService(WMSInfo.class); + wms.setFeaturesReprojectionDisabled(true); + getGeoServer().save(wms); + // execute the request + doc = getAsDOM(request); + // check that features were not reprojected and still in EPSG:4326 + assertXpathMatches(".*4326", + "/wfs:FeatureCollection/gml:featureMember/gsml:MappedFeature[@gml:id='mf2']/gsml:shape/gml:Polygon/@srsName", + doc); } @Test diff --git a/src/web/wms/src/main/java/org/geoserver/wms/web/WMSAdminPage.html b/src/web/wms/src/main/java/org/geoserver/wms/web/WMSAdminPage.html index 8fbf8980a34..90cd4c15e18 100644 --- a/src/web/wms/src/main/java/org/geoserver/wms/web/WMSAdminPage.html +++ b/src/web/wms/src/main/java/org/geoserver/wms/web/WMSAdminPage.html @@ -238,6 +238,21 @@ +