2

Is it possible to set up a WMS server (I am a bit familiar with GeoServer so this would be my preferred option but of course I'm open to learn something new...) that publishes an instance of a Leaflet map together with some vector overlays (e.g. GeoJSON, shapefile, whatever..)? Or am I mixing up things completely here because maps created in JavaScript cannot be published like this?

This would be nice to have for my usecase as I have set up a nice map with Leaflet which receives map tiles from our company's own tile server, does some styling, uses Leaflet plugins to display interesting stuff etc.

I would like to do some automated GetMap requests on that map for bounding box extents that I generate programmatically and save the resulting images to disk.

The closest I could think of would be to use MapProxy to combine my custom tile layer with my vector overlays (directly or prepared by and connected through GeoServer) and publish that as a WMS server. However, this would lack the styling and plugin stuff that I can do in Leaflet.

3
  • What do you want as an end-result?
    – Alex Leith
    Apr 16, 2015 at 5:13
  • The end result would be a WMS Server which responds to GetMap requests by providing a static image made of a Leaflet map combined with some vector overlays.
    – Dirk
    Apr 16, 2015 at 12:05
  • Well Leaflet doesn't do that. You can do it with GeoServer, though. Do all your styling with GeoServer and then you can display it with Leaflet or just run a getmap request and get a static image. Leaflet is for making a slippy map, not an image. Also, you can install a plugin for GeoServer that sets up PDF output.
    – Alex Leith
    Apr 17, 2015 at 2:07

1 Answer 1

1

I think you are mixing up a couple of things.

When you install Geoserver, it comes with a lite distribution of OpenLayers. That is used to preview the data once you publish some. But this functionality is only suitable for previewing, and not as a production front-end.

If you want a Production quality front end, you need to develop that yourself. You can use any client which supports Geoserver's OGC Services( i.e. WMS, WFS etc).

Many people use OpenLayers as a JavaScript Library for this, or you could also use Leaflet.

There are many examples on this site which talk about doing so, for example: Combine Leaflet with Geoserver WMS map

If your Geoserver or data cannot be projected in Web Mercator, then you can us a Leaflet plugin called Proj4Leaflet, which can display a Map in projections other than Web Mercator. See this example.

2
  • Okay, thanks. If I could live without the special Leaflet features and just want to publish a map being composed of a basemap from a tile server in the form of https://myserver.com/{z}/{x}/{y}.png and some vector overlays such that the end result can be received as a static image by a GetMap request - is this what I need then? geowebcache.org/docs/current/index.html I already tried to do something similar with a combination of GeoServer and MapProxy but it was very hard to set it up properly.
    – Dirk
    Apr 16, 2015 at 12:13
  • If you have a Map service in Z/x/y format, why don't you use that directly? why do you need to make a getMap request? Am I missing something? Apr 18, 2015 at 6:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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