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 have used following mapfile to create the WFS service on Mapserver but struggling to display the service output using OpenLayers.

Please suggest some links to use WFS service in openlayers.

Thanks in advance.

   MAP
  NAME "WFS_server"
  STATUS ON
  SIZE 600 300
  #SYMBOLSET "../etc/symbols.txt"
  #EXTENT -180 -90 180 90
  UNITS DD
  #SHAPEPATH "../data"
  IMAGECOLOR 255 255 255
  #FONTSET "../etc/fonts.txt"


  #
  # Start of web interface definition
  #
  WEB
    IMAGEPATH "/ms4w/tmp/ms_tmp/"
    IMAGEURL "/ms_tmp/"
    METADATA
      "wfs_title"          "WFS Demo Server for MapServer" ## REQUIRED
      "wfs_onlineresource" "http://demo.mapserver.org/cgi-bin/wfs?" ## Recommended
      "wfs_srs"            "EPSG:4326 EPSG:4269 EPSG:3978 EPSG:3857" ## Recommended
      "wfs_abstract"       "This text describes my WFS service." ## Recommended
      "wfs_enable_request" "*"  # necessary
    END
  END

  PROJECTION
    "init=epsg:4326"
  END

  #
  # Start of layer definitions
  #

  ##################
  # World Continents
  ##################
  LAYER
    NAME "Mumbai_City"
    METADATA
      "wfs_title"         "World continents" ##REQUIRED
      "wfs_srs"           "EPSG:4326" ## REQUIRED
      "gml_include_items" "all" ## Optional (serves all attributes for layer)
      "gml_featureid"     "ID" ## REQUIRED
      "wfs_enable_request" "*"
    END
    TYPE POLYGON
    STATUS ON
    DATA '/ms4w/data/Mumbai_City_Boundry.shp'
    PROJECTION
      "init=epsg:4326"
    END
    CLASS
      NAME 'Mumbai City'
      STYLE
        COLOR 255 128 128
        OUTLINECOLOR 96 96 96
      END
    END
  END #layer

END #mapfile
share|improve this question
1  
can you add what you have tried so far and why/what is not working for you. Otherwise the question is too broad to answer –  iant Jun 1 '12 at 9:45
    
I have used WMS and MapServer and it is working fine But the WFS and Vector service is not working. –  Gunner Jun 1 '12 at 10:20
    
The MapFile I have used is it valid...??? and please suggest some link WFS sevice on mapserver and use in the openlayers... –  Gunner Jun 1 '12 at 10:23

1 Answer 1

up vote 3 down vote accepted

you can check out this example here for source code - MapServer WFS Demo and OpenLayers 2.10 SLD support for vector styles.

Beside this you can glance at:

  • MapServer and OpenLayers configuration here

  • WFS: WA National Parks Example, here

and your wfs call for vector layer similir to this:

lyr = new OpenLayers.Layer.Vector("WFS protocol continents", {
        strategies: [new OpenLayers.Strategy.BBOX()],
        protocol: new OpenLayers.Protocol.WFS({
                      "url": url,
                      "propertyNames": propertyNames,
                      "geometryName": "msGeometry",
                      "featureType": "continents",
                      "featurePrefix": "ms",
                      "srsName": "EPSG:4326",
                      "maxFeatures": 1000,
                      "version": "1.0.0"
                  })
    });

i hope it helps you...

share|improve this answer
    
@Aregon still not working. What should be url,propertyNames,geometryName,featureType,featurePrefix,srsName for the layer should come?.I have used localhost/cgi-bin/mapserv.exe?map=/ms4w/Apache/htdocs/demos/… still not working. –  Gunner Jun 5 '12 at 9:12

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.