Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to produce a png image that uses OpenStreetMap data and has a vector overlaid on the base data. I am able to produce the vector overlay from within Mapserver, but I have difficulty understanding how to include an external data source like OpenStreetMap.

I would prefer to use an external service over loading the OpenStreetMap data directly as I wish to use it only as a basemap.

Is it possible to do this from within MapServer?

share|improve this question

This is documented here. In short, you can add a WMS layer within your mapfile as follows:

      NAME "country_bounds"
        "wms_srs"             "EPSG:4326"
        "wms_name"            "country_bounds"
        "wms_server_version"  "1.1.1"
        "wms_format"          "image/gif"

There are OpenStreetMap WMS' available here

share|improve this answer
Thanks for the suggestion. For the linked OSM WMS, do you know what the connection info would be? For example I can find but nothing with WMS in the address. – djq Oct 29 '12 at 17:13

I would suggest that you think about meeting your requirements with a slightly different approach.

MapServer can cascade WMS services, but I am not aware of any public WMS services that serve up OSM data for free. Most OSM data services that I am aware of use the tiled TMS specification.

If your version of MapServer is compiled with a version of GDAL that supports the TMS standard (via the WMS mini-driver), you can theoretically pull it off, but I don't believe that it is widely used.

The simplest solution is to keep the basemap and data layers separate on the server side and combine them in the client. Configure your map client to use OSM data tiles from MapQuest Open, CloudMade, OSM, or someone else for the base layer. Create a transparent layer for your own data and pull it into your client via WMS.

Make sure that you look at and honor the license/usage requirements for your source of OSM tiles.

share|improve this answer
Thanks for the suggestion. I am currently combining these on the browser side using OpenLayers, and an OSM base-map but I am interested in combining them on the server side also. – djq Oct 29 '12 at 18:12
There is a free OSM-WMS at (as dmci already pointed out). – mistapink Oct 29 '12 at 21:37

I do not use MapServer but this tutorial seems to describe the steps to enable MapServer to consume WMS.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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