When do you decide which to use? I've started using Geoserver and it seems like map files are downloaded to the browser (using Leaflet) in the WFS format.

When I look at OSM, Mapbox etc, they use what I believe is the slippy map format: /zoom/x/y.png 256x256 tiles.

Should Geoserver be configured to use slippy map format? And will using WMS prevent slippy map interactions like Google maps and Leaflet?

What are your recommendations if I'm using Geoserver and Leaflet and want to serve some map tiles.


I think what you want to do is make a slippy map, right?

This is very easy with Leaflet and GeoServer, so long as you only want to view information.

In GeoServer, style a layer, and test it. Then, with Leaflet, add the layer from GeoServer via WMS. Example is included below, replace all the with your values:

<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.css" />
<!--[if lte IE 8]>
 <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.ie.css" />

<script src="http://cdn.leafletjs.com/leaflet-0.5/leaflet.js"></script>

<div id="map"  style="width: 800px; height: 600px"></div>

    var center = new L.LatLng(<LAT>,<LON>);
    var map = new L.Map('map', { center: center, zoom: 14, attributionControl:true, zoomControl:false});   
    var gi = new L.TileLayer.WMS("http://<SERVER>:8080/geoserver/gwc/service/wms", {
        layers: '<WORKSPACE>:<LAYER NAME>',
        format: 'image/png',
        maxZoom: 20

If you actually want vectors, consider carefully why. You can achieve it using tileJSON, but it isn't simple. You can query the WMS layer, though, and highlight individual features, which is quite nice!

| improve this answer | |

I don't think leaflet supports WFS till now. OSM uses tile server where the actual images are stored as tiles and served to clients, whereas in geoserver the actual data is vector and images are made on client request and served. I don't know much about leaflet but openlayers supports both tiled and untiled WMS.

there is no need to configure geoserver for slippy map. just use leaflets TileLayer.WMS.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.