public void setProjectionPolicy(ProjectionPolicy policy) { delegate.setProjectionPolicy(policy); }
if (code != null) { cinfo.setSRS("EPSG:" + code); cinfo.setProjectionPolicy(ProjectionPolicy.REPROJECT_TO_DECLARED); cinfo.setProjectionPolicy(ProjectionPolicy.FORCE_DECLARED);
if (code != null) { cinfo.setSRS("EPSG:" + code); cinfo.setProjectionPolicy(ProjectionPolicy.FORCE_DECLARED); cinfo.setProjectionPolicy(ProjectionPolicy.REPROJECT_TO_DECLARED); cinfo.setProjectionPolicy(ProjectionPolicy.FORCE_DECLARED);
@Test public void testNativeBoundsDefensiveCopy() throws Exception { Catalog cat = getCatalog(); CatalogBuilder cb = new CatalogBuilder(cat); cb.setStore(cat.getCoverageStoreByName(MockData.TASMANIA_DEM.getLocalPart())); CoverageInfo ci = cb.buildCoverage(); // setup the reproject to declared policy, the issue happens only under this condition ReferencedEnvelope nativeBounds = ci.getNativeBoundingBox(); for (ProjectionPolicy pp : ProjectionPolicy.values()) { ci.setProjectionPolicy(pp); ReferencedEnvelope bbox = ci.boundingBox(); assertNotSame(nativeBounds, bbox); } }
ci.setProjectionPolicy(ProjectionPolicy.FORCE_DECLARED); ci.setSRS("EPSG:3857"); catalog.save(ci);
info.setProjectionPolicy(ProjectionPolicy.REPROJECT_TO_DECLARED);
info.setProjectionPolicy(ProjectionPolicy.REPROJECT_TO_DECLARED);
@Test public void testRasterKeepNative() throws Exception { // force it to "keep native" CoverageInfo ci = getCatalog().getCoverageByName(getLayerId(CUSTOM)); ci.setProjectionPolicy(ProjectionPolicy.NONE); getCatalog().save(ci); // make a first reprojected request on a pixel that's black (0) String result = getAsString( "wms?REQUEST=GetFeatureInfo&EXCEPTIONS=application%2Fvnd.ogc.se_xml" + "&BBOX=-887430.34934%2C4467316.30601%2C-885862.361705%2C4468893.535223&SERVICE=WMS" + "&INFO_FORMAT=text%2Fplain&QUERY_LAYERS=cite%3Acustom&FEATURE_COUNT=50&Layers=custom" + "&WIDTH=509&HEIGHT=512&format=image%2Fjpeg&styles=&srs=epsg%3A900913&version=1.3.0&i=177&j=225"); assertTrue(result.contains("0.0")); // and now one with actual data, 2 result = getAsString( "wms?REQUEST=GetFeatureInfo&EXCEPTIONS=application%2Fvnd.ogc.se_xml" + "&BBOX=-887430.34934%2C4467316.30601%2C-885862.361705%2C4468893.535223&SERVICE=WMS" + "&INFO_FORMAT=text%2Fplain&QUERY_LAYERS=cite%3Acustom&FEATURE_COUNT=50&Layers=custom" + "&WIDTH=509&HEIGHT=512&format=image%2Fjpeg&styles=&srs=epsg%3A900913&version=1.3.0&i=135&j=223"); assertTrue(result.contains("2.0")); }
@Test public void testRasterKeepNative() throws Exception { // force it to "keep native" CoverageInfo ci = getCatalog().getCoverageByName(getLayerId(CUSTOM)); ci.setProjectionPolicy(ProjectionPolicy.NONE); getCatalog().save(ci); // make a first reprojected request on a pixel that's black (0) String result = getAsString( "wms?REQUEST=GetFeatureInfo&EXCEPTIONS=application%2Fvnd.ogc.se_xml" + "&BBOX=-887430.34934%2C4467316.30601%2C-885862.361705%2C4468893.535223&SERVICE=WMS" + "&INFO_FORMAT=text%2Fplain&QUERY_LAYERS=cite%3Acustom&FEATURE_COUNT=50&Layers=custom" + "&WIDTH=509&HEIGHT=512&format=image%2Fjpeg&styles=&srs=epsg%3A900913&version=1.1.1&x=177&y=225"); assertTrue(result.contains("0.0")); // and now one with actual data, 2 result = getAsString( "wms?REQUEST=GetFeatureInfo&EXCEPTIONS=application%2Fvnd.ogc.se_xml" + "&BBOX=-887430.34934%2C4467316.30601%2C-885862.361705%2C4468893.535223&SERVICE=WMS" + "&INFO_FORMAT=text%2Fplain&QUERY_LAYERS=cite%3Acustom&FEATURE_COUNT=50&Layers=custom" + "&WIDTH=509&HEIGHT=512&format=image%2Fjpeg&styles=&srs=epsg%3A900913&version=1.1.1&x=135&y=223"); assertTrue(result.contains("2.0")); }
@Test public void testRasterReprojectToDeclared() throws Exception { // force it to "reproject to declared" CoverageInfo ci = getCatalog().getCoverageByName(getLayerId(CUSTOM)); ci.setProjectionPolicy(ProjectionPolicy.REPROJECT_TO_DECLARED); ci.setSRS("EPSG:900913"); getCatalog().save(ci); // make a first reprojected request on a pixel that's black (0) String result = getAsString( "wms?REQUEST=GetFeatureInfo&EXCEPTIONS=application%2Fvnd.ogc.se_xml" + "&BBOX=-887430.34934%2C4467316.30601%2C-885862.361705%2C4468893.535223&SERVICE=WMS" + "&INFO_FORMAT=text%2Fplain&QUERY_LAYERS=cite%3Acustom&FEATURE_COUNT=50&Layers=custom" + "&WIDTH=509&HEIGHT=512&format=image%2Fjpeg&styles=&srs=epsg%3A900913&version=1.3.0&i=177&j=225"); assertTrue(result.contains("0.0")); // and now one with actual data, 2 result = getAsString( "wms?REQUEST=GetFeatureInfo&EXCEPTIONS=application%2Fvnd.ogc.se_xml" + "&BBOX=-887430.34934%2C4467316.30601%2C-885862.361705%2C4468893.535223&SERVICE=WMS" + "&INFO_FORMAT=text%2Fplain&QUERY_LAYERS=cite%3Acustom&FEATURE_COUNT=50&Layers=custom" + "&WIDTH=509&HEIGHT=512&format=image%2Fjpeg&styles=&srs=epsg%3A900913&version=1.3.0&i=135&j=223"); assertTrue(result.contains("2.0")); }
@Test public void testRasterReprojectToDeclared() throws Exception { // force it to "reproject to declared" CoverageInfo ci = getCatalog().getCoverageByName(getLayerId(CUSTOM)); ci.setProjectionPolicy(ProjectionPolicy.REPROJECT_TO_DECLARED); ci.setSRS("EPSG:900913"); getCatalog().save(ci); // make a first reprojected request on a pixel that's black (0) String result = getAsString( "wms?REQUEST=GetFeatureInfo&EXCEPTIONS=application%2Fvnd.ogc.se_xml" + "&BBOX=-887430.34934%2C4467316.30601%2C-885862.361705%2C4468893.535223&SERVICE=WMS" + "&INFO_FORMAT=text%2Fplain&QUERY_LAYERS=cite%3Acustom&FEATURE_COUNT=50&Layers=custom" + "&WIDTH=509&HEIGHT=512&format=image%2Fjpeg&styles=&srs=epsg%3A900913&version=1.1.1&x=177&y=225"); assertTrue(result.contains("0.0")); // and now one with actual data, 2 result = getAsString( "wms?REQUEST=GetFeatureInfo&EXCEPTIONS=application%2Fvnd.ogc.se_xml" + "&BBOX=-887430.34934%2C4467316.30601%2C-885862.361705%2C4468893.535223&SERVICE=WMS" + "&INFO_FORMAT=text%2Fplain&QUERY_LAYERS=cite%3Acustom&FEATURE_COUNT=50&Layers=custom" + "&WIDTH=509&HEIGHT=512&format=image%2Fjpeg&styles=&srs=epsg%3A900913&version=1.1.1&x=135&y=223"); assertTrue(result.contains("2.0")); }
coverage.setAdvertised(false); coverage.setNativeCoverageName("coverage-NativeCoverageName"); coverage.setProjectionPolicy(ProjectionPolicy.FORCE_DECLARED); catalog.add(coverage);