This question is related to "Options for displaying PostGIS vectors in OpenLayers?", but I need SVG output on server. OpenLayers must render SVG directly.

We are using Mapserver6, and thinking on WFS server mode (can be other?)... Need TinyOWS to faster output or easier configuration?

There are tutorials (?) for the problem of multiples minscale/maxscale on Mapfile layers -- for use something like st_union and st_simplify PostGIS functions to reduce trafic and complexity on big vectors.

For display we think to use some like,

map.addLayer( new OpenLayers.Layer.Vector(
    {   strategies: [new OpenLayers.Strategy.BBOX()],
        protocol: new OpenLayers.Protocol.WFS({
            url: conf_url_wfs,
            featureType: "setores_vector", 
            featureNS: "http://www.openplans.org/topp"
        renderers: ["SVG"]
    {isBaseLayer:false,visibility: true}

There are a Mapserver example like this simple GeoServer example? Examples with Mapfile also (and connectiontype=postgis).

2 Answers 2


You can look here an example of mapserver settings for svg...in mapserver for svg support with wms is not supported yet. You can read here. FORMATOPTION “COMPRESSED_OUTPUT=TRUE” is set MapServer will produce a compressed SVG file (svgz) maybe you will need this too..

and in openlayers showing svg file pls read SVGWeb which has lots of examples for you....

  NAME 'japan'
  EXTENT 122.935414 24.040589 153.986285 45.554518
  STATUS OFF # we don't want a raster map
  SHAPEPATH "/usr/local/apache/htdocs/japan/data/"
    HEADER '../header.svg'
    FOOTER '../footer.svg'
    QUERYFORMAT 'image/svg+xml'

  NAME "z9_road"
  CONNECTION "user=postgres dbname=gsi2500 host= port=5432"
  DATA "the_geom from (select gid,the_geom from z9_road) as foo using unique gid using SRID=4301"
  HEADER ../z9_road_header.svg
  FOOTER ../z9_road_footer.svg
  TEMPLATE ../z9_road_template.svg

i hope it helps you....

  • Thanks a lot! Do you have also the OpenLayers Javascript fragment, or link, that use this Mapfile? (featureType parameter is "z9_road" or "japan"?) I will test all your clues this week (!). Commented May 16, 2012 at 13:58

You dont want to go for mapserver because you have the postGIS database. setup tinyOWS server and you can access it using openlayers like other WFS-T services. see tinyOWS configuration. its simple and easy. Also you can find a sample OpenLayers Example with WFS-T.

Happy GIS ing

  • Sounds as good news, thanks a lot (!)... Perhaps little problem: the OpenLayers example not use SVG image, only JPG, "{layers: 'osm', format: 'image/jpeg'}". Do you have a (complete) SVG example? Commented Nov 5, 2012 at 7:16

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.