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=image%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/main/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/main/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