11

My organization has a web application for displaying global and regional climate data and we're considering improvements to it. Our leading idea is to create an OpenLayers-based application to display climate rasters over base layers like OSM or Google Maps. The map may also include some other application-specific vector layers and a color bar or other legend features describing the data. Near as I can tell, this all seems do-able with OpenLayers.

One requirement for the project, though, is to be able to export (ideally from the web-app) publication quality (more-or-less) maps. A typical use case would be something like this:

  1. A user, using the base layer as a guide, navigates to their area of interest
  2. The user selects a climate parameter (e.g. mean temp for the 2040s) or set of parameters
  3. The user hits the "export" button and then downloads a good quality map which includes all of the elements described in the first paragraph.

I haven't been able to find anything in OpenLayers about rendering to an image. Does anyone know whether this is possible? And if not what other approaches for rendering could we take? I would suppose that we would need to pass all of the map parameters (bbox, projection, included layers, etc.) out to some external rendering engine; what open source rendering engines are out there?

1
  • I have implemented exporting as png/pdf and printing of openlayers maps here at www.mapsdata.co. you can register and check.
    – Rayiez
    Jan 3, 2013 at 5:53

3 Answers 3

12

The main ways to display pretty print maps from openlayers I know are:

-Geoserver with Geoext

-Mapfish with Geoext

Both solutions rely on a java part(e.g. http://geoserver.org/display/GEOS/Printing+in+GeoServer or http://www.mapfish.org/doc/print/)

-Openlayers standalone (See the official doc http://trac.openlayers.org/wiki/Printing)

More recently, a technique appears to render image with PhantomJS (a software simulating browser from command line) http://acuriousanimal.com/blog/2012/09/17/creating-static-maps-in-openlayers-using-phantomjs/

Some recent libraries use browser Canvas rendering abilities to "catch" image like this OpenLayers 3 example or this Leaflet one

5

Think you will need to look into Geoserver to create a WFS or WMS or WMST service http://geoserver.org/display/GEOS/What+is+Geoserver

Then Openlayers can parse the Geoserver service

http://openlayers.org/dev/examples/getfeature-wfs.html

WMTS (Web Map Tile Service) http://openlayers.org/dev/examples/wmts.html

2

To get "publication quality" you want 300dpi, so using the maps you pass to open layers for screen rendering is probably a non-starter.

OpenStreetMap's export tab uses OpenLayers to select what you want to export, but then renders it with a separate backend server process (actually a choice of several). This is probably the approach you will have to take. You are unlikely to be able to use Google Maps for this.

1
  • Well, "publication quality" would more likely mean svg or some other vector format. And when I put it in those terms, it makes me think that, yes, we probably will want to use Mapnik or something to render a basemap from the planet.osm file. Then we could use some image library to overlay the other elements (climate raster, legend elements, attributes). You're right that Gmaps is probably out for the exporter (for a variety of technical and non-technical reasons). Anyways, thanks for all of the responses.
    – Hiebert
    Sep 10, 2010 at 16:12

Your Answer

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

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