Sunday, 28 February 2016

wms - GeoServer: Receive multiple tiles from layer


Using GeoServer you can do a WMS request to receive a single PNG representation of a certain layer using something like this.


http://localhost:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=spearfish&styles=&bbox=589425.9342365642,4913959.224611808,609518.6719560538,4928082.949945881&width=512&height=359&srs=EPSG:26713&format=image%2Fpng

Is it possible to alter this request to directly request different "zoom levels" or "tiles" of the layer? I assume you need to do a Web Map Tile Service (WMTS) request but I can't seem to find any documentation on how to do this. Any guidance would be helpful.



Answer




If you want to get a 256*256 PNG tile of a certain map service from geoserver you can do it with including tiled=TRUE in your request:


http://localhost:8080/geoserver/wms?LAYERS=spearfish&STYLES=&FORMAT=image%2Fpng&TILED=true&TILESORIGIN=589425.93423656%2C4913959.2246118&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG%3A26713&BBOX=589425.93423656,4913959.2246118,609518.67195605,4934051.9623313&WIDTH=256&HEIGHT=256

But there's no zoom parameter in the request, and the client side application will take care of the certain zoom level and the bounding box.


But if you insist on using WMTS (which capability is included in GeoServer with GeoWebCache integration) you can do it with the following request:


http://v2.suite.opengeo.org/geoserver/gwc/service/wmts/?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=medford%3Abuildings&STYLE=_null&TILEMATRIXSET=EPSG%3A900913&TILEMATRIX=EPSG%3A900913%3A13&TILEROW=3030&TILECOL=1300&FORMAT=image%2Fpng 

Here the TILEROW and TILECOL are the key parameters. But if you want to extend your knowledge about WMTS I would suggest you to check out the official OGC standard here:


http://www.opengeospatial.org/standards/wmts


And you can find useful information about WMTS in geoserver at the following link:



http://docs.geoserver.org/latest/en/user/webadmin/tilecache/defaults.html?highlight=wmts


I hope this helps!


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...