How to generate MBTiles in GeoServer? Using OpenLayers for displaying a GeoServer layer. For example calling a WMS layer like this:
new OpenLayers.Layer.WMS("Kanpur", "http://localhost:8080/geoserver/wms", {
LAYERS: 'sample_data_old:sample',
STYLES: '',
format: 'image/jpeg',
tiled: false,
transparent: true,
tilesOrigin : map.maxExtent.left + ',' + map.maxExtent.bottom,
visibility:false
}, {
isBaseLayer: true
}
);
How can I call WPS layer for creating MBTiles? Please refer this link for my question:
http://docs.geoserver.org/stable/en/user/community/mbtiles/output.html
I reached this question while trying to achieve just the same output as @renjith
So, here's what I did to generate MBTiles using GeoServer 2.19.4
Steps:
Make sure to match plugins versions with your GeoServer instance version!
After successful installation of the above requirements, you should be able to generate MBTiles of your datasource.
Using WPS request to your server
<?xml version="1.0" encoding="UTF-8"?>
<wps:Execute version="1.0.0" service="WPS"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.opengis.net/wps/1.0.0"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:wps="http://www.opengis.net/wps/1.0.0"
xmlns:ows="http://www.opengis.net/ows/1.1"
xmlns:gml="http://www.opengis.net/gml"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:wcs="http://www.opengis.net/wcs/1.1.1"
xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
<ows:Identifier>gs:MBTiles</ows:Identifier>
<wps:DataInputs>
<wps:Input>
<ows:Identifier>layers</ows:Identifier>
<wps:Data>
<wps:LiteralData>layerName</wps:LiteralData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>format</ows:Identifier>
<wps:Data>
<wps:LiteralData>imageFormat</wps:LiteralData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>boundingbox</ows:Identifier>
<wps:Data>
<wps:BoundingBoxData crs="layerCRS" dimensions="2">
<ows:LowerCorner>MinX MinY</ows:LowerCorner>
<ows:UpperCorner>MaxX MaxY</ows:UpperCorner>
</wps:BoundingBoxData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>filename</ows:Identifier>
<wps:Data>
<wps:LiteralData>fileName</wps:LiteralData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>minZoom</ows:Identifier>
<wps:Data>
<wps:LiteralData>minZoom</wps:LiteralData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>maxZoom</ows:Identifier>
<wps:Data>
<wps:LiteralData>maxZoom</wps:LiteralData>
</wps:Data>
</wps:Input>
</wps:DataInputs>
<wps:ResponseForm>
<wps:RawDataOutput>
<ows:Identifier>outputFormat</ows:Identifier>
</wps:RawDataOutput>
</wps:ResponseForm>
</wps:Execute>
Make sure to replace each input to match your needs!
This request may require basic authentication if map services are protected, and will return a URL of available generated file to be downloaded!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With