On Fri, Feb 23, 2018 at 11:13 AM, Ian Turton wrote:
> I think the easiest answer is to request two separate images on either
> side of 180/-180.
>
> Some of the data stores handle crossing the antimeridian or possibly that
> is all handled in GeoServer (see http://blog.geoserver.org/
> 2010/02/23/geoserver-map-wrapping/). So you might get the correct answer
> by using a WMSLayer rather than making a direct WMS request yourself, but I
> haven't tried that.
>
GeoServer enables that support in streaming renderer, something like this:
Map
I think the easiest answer is to request two separate images on either side
of 180/-180.
Some of the data stores handle crossing the antimeridian or possibly that
is all handled in GeoServer (see
http://blog.geoserver.org/2010/02/23/geoserver-map-wrapping/). So you might
get the correct answer by using a WMSLayer rather than making a direct WMS
request yourself, but I haven't tried that.
Ian
On 23 February 2018 at 00:20, Andrea Mari wrote:
> I send it again because with the attachment was too big.
>
>
>
> Thank you very much, it works now.
>
>
>
> Now that I’ve solved my issue, I’ve got a second one.
>
>
>
> The real coordinates I’m using to create a rectangle in the South pacific
> are
>
> getMapRequest.setBBox("162,-24,-156,17");
>
> but due to the fact that I’m going through the 0 meridian, the Envelope
> doesn’t recognise correctly the minx and maxX (it swaps them)
>
> I’ve also tried to use 162 and 203 (assuming to use a 360 degree scale)
>
>
>
> Any idea?
>
>
>
> Thank you
>
> Andrea
>
>
>
> *From: *Andrea Mari
> *Date: *Friday, 23 February 2018 at 1:18 PM
> *To: *Ian Turton
> *Cc: *"geotools-gt2-users@lists.sourceforge.net" <
> geotools-gt2-users@lists.sourceforge.net>
> *Subject: *Re: [Geotools-gt2-users] GetMapRequest
>
>
>
> Thank you very much, it works now.
>
>
>
> Now that I’ve solved my issue, I’ve got a second one.
>
>
>
> The real coordinates I’m using to create a rectangle in the South pacific
> are
>
> getMapRequest.setBBox("162,-24,-156,17");
>
> but due to the fact that I’m going through the 0 meridian, the Envelope
> doesn’t recognise correctly the minx and maxX (it swaps them)
>
> I’ve also tried to use 162 and 203 (assuming to use a 360 degree scale)
>
>
>
> Any idea?
>
>
>
> Attached a picture of the area I would like to get from the server.
>
>
>
> Thank you
>
> Andrea
>
>
>
>
>
> *From: *Ian Turton
>
> *Date: *Thursday, 22 February 2018 at 10:31 PM
> *To: *Andrea Mari
> *Cc: *"geotools-gt2-users@lists.sourceforge.net" <
> geotools-gt2-users@lists.sourceforge.net>
> *Subject: *Re: [Geotools-gt2-users] GetMapRequest
>
>
>
> That URL and bounding box work fine for me, using this code
> https://gitlab.com/snippets/1700238
>
> If it fetches the whole world it is possible you are not setting the
> bounds of your map viewport, so you may need to add something like (where
> content is your MapContent):
>
> content.getViewport().setCoordinateReferenceSystem(crs);
> content.getViewport().setBounds(bbox);
>
> Ian
>
>
>
> On 22 February 2018 at 03:11, Andrea Mari wrote:
>
> 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 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=1.
> 1.1=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
>
>
>
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
>
>
> --
>
> Ian Turton
>
>
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
--
Ian Turton
--
Check out the vibrant tech community on one