I do have a couple of other URLs that do work. Possible strangeness between these is that if I do a setSRS on some, the string in the URL that gets added is CRS=... and I don't get anything back. Others, the string is SRS=... and all is well. For those where the string becomes CRS=..., if I don't use setSRS, it works fine. Guessing lots of GeoTools fine points that I've got to learn.
E. Scott Stricker -----Original Message----- From: Mark Prins [mailto:[email protected]] Sent: Monday, April 23, 2012 10:53 AM To: geotools-gt2-users Subject: Re: [Geotools-gt2-users] EXT :Re: Geotools changing URL so request fails. 2012/4/23 Stricker, Scott (IS) <[email protected]>: > Couple more comments Mark: > > First, interesting that getcapabilities works fine, but I cannot get the map. > Maybe this is not unusual, I don't know. GetCapabilities and GetMap do not need to live at the same base url (though this is uncommon, it is possible and allowed), but I guess something else is going on here, I would just use some other WMS to play with first. > Also, my original work was with the OpenLayers toolkit and it has no issues > with the URL I'm trying to use. Very strange. > > Thanks again for the pointers. My code is very similar to that you pointed > me to. > > E. Scott Stricker > 703-561-3671 > > > -----Original Message----- > From: Mark Prins [mailto:[email protected]] > Sent: Saturday, April 21, 2012 3:07 AM > To: [email protected] > Subject: EXT :Re: [Geotools-gt2-users] Geotools changing URL so request fails. > > 2012/4/20 Stricker, Scott (IS) <[email protected]>: >> Starting to learn geotools 2.7.4. >> >> I’ve got a simple application to try to generate a map from a WMS server. >> I’ve found a map server on the web at >> >> http://labs.metacarta.com/wms/vmap0 >> >> I can use this URL to get the capabilities of the server, not a problem. >> When I try to get a map, however, I print out the URL from geotools >> >> http://vmap0.tiles.osgeo.org/wms?SERVICE=WMS&LAYERS=basic&FORMAT=imag >> e >> %2Fpng&HEIGHT=600&TRANSPARENT=TRUE&REQUEST=GetMap&WIDTH=800&BBOX=-180. >> 0,-90.0,180.0,90.0&STYLES=&VERSION=1.1.1 >> >> and when submitted, generates the dump below. >> >> Questions that come up include >> >> Why did the initial url change from ...com/wms/vmap0 to .com/wms and >> how can I prevent this. > > there is a redirect going on (if you sniff the networktraffic you will see a > "301 Moved Permanently" message pass by), you cannot prevent this apart from > breaking the connection as soon as you see the 301 message, which is not what > you want I guess. > > The stack trace is caused by the response not being an image (but a text > error message) so the ImageIO barfs, you may be able to work around this by > specifying the error return type as IN_IMAGE to the WMS. > > >> Got the following lines to set SRS and bounding box >> CRSEnvelope env = new >> CRSEnvelope("EPSG:4326",minLon,minLat,maxLon,maxLat); >> request.setBBox(env); > > I think this just sets the bbox param, not the srs param. > > Have peaak at this code here: > https://github.com/mprins/geozet/blob/geozet-4-2d/geozet-webapp/src/ma > in/java/nl/eleni/gcc/vpziek/servlet/WMSClientServlet.java#L282 > which does a wms request and the saves that to a png ad writes some text in > the png and does some fancy stuff with SLD body. > Further below there s a simpler method (getBackGround) which just retrieves a > BufferedImage from a WMS: > https://github.com/mprins/geozet/blob/geozet-4-2d/geozet-webapp/src/ma > in/java/nl/eleni/gcc/vpziek/servlet/WMSClientServlet.java#L406 > > > > > -- > Disclaimer; > This message is just a reflection of what I thought at the time of sending. > The message may contain information that is not intended for you or that you > don't understand. > > ---------------------------------------------------------------------- > -------- For Developers, A Lot Can Happen In A Second. > Boundary is the first to Know...and Tell You. > Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! > http://p.sf.net/sfu/Boundary-d2dvs2 > _______________________________________________ > GeoTools-GT2-Users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users -- Disclaimer; This message is just a reflection of what I thought at the time of sending. The message may contain information that is not intended for you or that you don't understand. ------------------------------------------------------------------------------ For Developers, A Lot Can Happen In A Second. Boundary is the first to Know...and Tell You. Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! http://p.sf.net/sfu/Boundary-d2dvs2 _______________________________________________ GeoTools-GT2-Users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users ------------------------------------------------------------------------------ For Developers, A Lot Can Happen In A Second. Boundary is the first to Know...and Tell You. Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! http://p.sf.net/sfu/Boundary-d2dvs2 _______________________________________________ GeoTools-GT2-Users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
