|
From: Andrea M. <And...@ni...> - 2018-02-22 03:11:25
|
Hello all,
I’m trying to get a subset of the WGS84 map from a server but it doesn’t work the way I expect.
It just keeps showing the whole world
What am I doing wrong?
MultithreadedHttpClient httpClient = new MultithreadedHttpClient();
httpClient.setReadTimeout(timeout);
httpClient.setConnectTimeout(timeout);
WebMapServer wms = new WebMapServer(new URL(serviceUrl), httpClient);
WMSCapabilities capabilities = wms.getCapabilities();
List<org.geotools.data.ows.Layer> layers = capabilities.getLayerList();
defaultWMSLayer = GeoToolsUtils.getDefaultWMSLayer(layers);
wmsLayer = new RSWMSLayer(wms, defaultWMSLayer);
GetMapRequest getMapRequest = wms.createGetMapRequest();
getMapRequest.addLayer(defaultWMSLayer);
getMapRequest.setBBox("162,-24,175,-13");
getMapRequest.setDimensions(mapPane.getSize());
getMapRequest.setFormat("image/png");
getMapRequest.setSRS("CRS:" + CRS.toSRS(crs));
wmsLayer.setTitle(defaultWMSLayer.getTitle());
map.layers().add(0, wmsLayer);
serviceUrl =http://ows.terrestris.de/osm/service?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities
("162,-24,175,-13") these are the coordinates in WGS84 to get a map of most of the Pacific Islands
Thank you very much for your help
Andrea
|