I have used following map file 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.
MAP
NAME "WFS_server"
STATUS ON
SIZE 600 300
UNITS DD
IMAGECOLOR 255 255 255
#
# 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
Best Answer
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:
i hope it helps you...