@Test public void testWMSGetFeatureInfo() throws Exception { GetFeatureInfoRequest gfi = new GetFeatureInfoRequest(); GetMapRequest gm = new GetMapRequest(); gm.setHeight(330); gm.setWidth(780); Envelope env = new ReferencedEnvelope(-126.81851, -115.818992, 44.852958, 49.5066, null); CoordinateReferenceSystem crs = CRS.decode("EPSG:4326", true); CoordinateReferenceSystem logCrs = CRS.decode("EPSG:4326", false); gm.setBbox(env); gm.setCrs(crs); gfi.setGetMapRequest(gm); gfi.setXPixel(260); gfi.setYPixel(63); gfi.setVersion("1.1.1"); gfi.setQueryLayers(Arrays.asList(createMapLayer("foo", "acme"), createMapLayer("bar", "acme"))); callback.operationDispatched(new Request(), op("GetFeatureInfo", "WMS", "1.1.1", gfi)); assertEquals("acme:foo", data.getResources().get(0)); assertEquals("acme:bar", data.getResources().get(1)); BBoxAsserts.assertEqualsBbox( new ReferencedEnvelope(48.62, 48.62, -123.15, -123.15, logCrs), data.getBbox(), 0.01); }
@Test public void testWMSGetFeatureInfoDifferentCrs() throws Exception { /* * BBOX 3833170.221556,1841755.690829, 4083455.358596,2048534.231783 * EXCEPTIONS application/vnd.ogc.se_xml * FEATURE_COUNT 50 * HEIGHT 423 * INFO_FORMAT text/html * Layers monitor-test:prov3348 * QUERY_LAYERS monitor-test:prov3348 * REQUEST GetFeatureInfo * SERVICE WMS * WIDTH 512 * format image/png * srs EPSG:3348 * styles * version 1.1.1 * x 259 * y 241 */ /* * -123.34927,48.44669,3960017.648,1933344.872 */ GetFeatureInfoRequest gfi = new GetFeatureInfoRequest(); GetMapRequest gm = new GetMapRequest(); gm.setHeight(423); gm.setWidth(512); Envelope env = new ReferencedEnvelope( 3833170.221556, 4083455.358596, 1841755.690829, 2048534.231783, null); CoordinateReferenceSystem crs = CRS.decode("EPSG:3348", true); CoordinateReferenceSystem logCrs = CRS.decode("EPSG:4326", false); gm.setBbox(env); gm.setCrs(crs); gfi.setGetMapRequest(gm); gfi.setXPixel(259); gfi.setYPixel(241); gfi.setVersion("1.1.1"); gfi.setQueryLayers(Arrays.asList(createMapLayer("foo", "acme"), createMapLayer("bar", "acme"))); callback.operationDispatched(new Request(), op("GetFeatureInfo", "WMS", "1.1.1", gfi)); assertEquals("acme:foo", data.getResources().get(0)); assertEquals("acme:bar", data.getResources().get(1)); BBoxAsserts.assertEqualsBbox( new ReferencedEnvelope(48.4, 48.4, -123.3, -123.3, logCrs), data.getBbox(), 0.1); }
@Test public void testWMSGetMap() throws Exception { GetMapRequest gm = new GetMapRequest(); gm.setLayers(Arrays.asList(createMapLayer("foo", "acme"))); Envelope env = new Envelope(100, 110, 70, 80); CoordinateReferenceSystem crs = CRS.decode("EPSG:4326", true); CoordinateReferenceSystem logCrs = CRS.decode("EPSG:4326"); gm.setBbox(env); gm.setCrs(crs); callback.operationDispatched(new Request(), op("GetMap", "WMS", "1.1.1", gm)); assertEquals("acme:foo", data.getResources().get(0)); BBoxAsserts.assertEqualsBbox( new ReferencedEnvelope(env, crs).toBounds(logCrs), data.getBbox(), 0.1); }
@Test public void testWMSGetMapDifferentCrs() throws Exception { // xMin,yMin 5988504.35,851278.90 : xMax,yMax 7585113.55,1950872.01 // xMin,yMin -95.1193,42.2802 : xMax,yMax -71.295,53.73 GetMapRequest gm = new GetMapRequest(); gm.setLayers(Arrays.asList(createMapLayer("foo", "acme"))); Envelope env = new Envelope(5988504.35, 7585113.55, 851278.90, 1950872.01); CoordinateReferenceSystem crs = CRS.decode("EPSG:3348", true); gm.setBbox(env); gm.setCrs(crs); callback.operationDispatched(new Request(), op("GetMap", "WMS", "1.1.1", gm)); CoordinateReferenceSystem logCrs = CRS.decode("EPSG:4326", false); BoundingBox bbox = new ReferencedEnvelope(42.2802, 53.73, -95.1193, -71.295, logCrs); assertEquals("acme:foo", data.getResources().get(0)); BBoxAsserts.assertEqualsBbox(bbox, data.getBbox(), 0.1); }