Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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
add comment

3 Answers 3

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

    LAYER
      NAME "country_bounds"
      TYPE RASTER
      STATUS ON
      CONNECTION "http://demo.mapserver.org/cgi-bin/wms?"
      CONNECTIONTYPE WMS
      METADATA
        "wms_srs"             "EPSG:4326"
        "wms_name"            "country_bounds"
        "wms_server_version"  "1.1.1"
        "wms_format"          "image/gif"
      END
    END

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 http://129.206.228.72/osm-proxy/service? but nothing with WMS in the address. –  djq Oct 29 '12 at 17:13
add comment

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) http://www.gdal.org/frmt_wms.html, 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 www.oms-wms.de (as dmci already pointed out). –  mistapink Oct 29 '12 at 21:37
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

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.