[mapserver-users] Simple up-to-date example for Mapserver and Openlayers (WFS)

Ömür D. Dalan omurdd at gmail.com
Thu Feb 11 09:54:33 EST 2010


I've searched tons of sites and read, try to implement many examples but
can't find a good'n simple tutorial for a map served with Mapserver WFS
server and screened with Openlayers. I think that's possible to draw a map
using only wfs. My map file and WFS conf. works good with Quantum GIS but
not with openlayers. Could some one help me to find my way ?

By the way here's my configuration


<---OL.html--->

<html>
<head>
  <title>OpenLayers Example</title>
    <script src="http://openlayers.org/api/OpenLayers.js"></script>
    </head>
    <body>
      <div style="width:100%; height:100%" id="map"></div>
      <script defer="defer" type="text/javascript">

var map = new OpenLayers.Map('map');

var wms = new OpenLayers.Layer.WMS("MyWMS","
http://194.27.174.184/cgi-bin/mapserv?map=/Library/WebServer/Documents/myMap.map&",
{layers: 'Ilce_Sinirlari'});
        map.addLayer(wms);

var wfs = new OpenLayers.Layer.Vector("Ilce_Sinirlari", {
        strategies: [new OpenLayers.Strategy.BBOX()],
        protocol: new OpenLayers.Protocol.WFS({
            url: "
http://194.27.174.184/cgi-bin/mapserv?map=/Library/WebServer/Documents/myMap.map&service=WFS&
",
            featureType: "Ilce_Sinirlari",
            featureNS: "http://mapserver.gis.umn.edu/mapserver"
        })
    });
    map.addLayer(wfs);
 map.setCenter(new
OpenLayers.Bounds(26.739934,38.190944,27.373940,38.636502).getCenterLonLat(),11);
      </script>

</body>
</html>

<---OL.html--->

<---myMap.map--->

MAP
NAME myMap
STATUS ON
SIZE 1000 600
EXTENT 26.739934 38.190944 27.373940 38.636502
UNITS METERS
SHAPEPATH "./mapFiles"
IMAGECOLOR 255 255 255
PROJECTION
"init=epsg:4326"
END
   OUTPUTFORMAT
NAME "aggpng24"
DRIVER AGG/PNG
MIMETYPE "image/png"
IMAGEMODE RGB
EXTENSION "png"
END
 IMAGETYPE aggpng24
 WEB
IMAGEPATH "./tmp/"
IMAGEURL "tmp/"
TEMPLATE "./basicTemplate.html"
METADATA
"wfs_title" "myMAP DEMO WFS SERVICE"
"wfs_onlineresource" "
http://194.27.174.184/cgi-bin/mapserv?map=/Library/WebServer/Documents/myMap.map&service=WFS
"
"wfs_srs" "EPSG:4326"
END
END
LAYER
NAME "Ilce_Sinirlari"
TYPE POLYGON
STATUS DEFAULT
EXTENT 26.739934 38.190944 27.373940 38.636502
PROJECTION
"init=epsg:4326"
END
CONNECTIONTYPE OGR
CONNECTION "ilceSinir.TAB"
#DATA "ilceler.SHP"
DUMP TRUE
METADATA
"wfs_title" "Ilce_Sinirlari"
"gml_featureid" "ADINUMARAS"
"gml_include_items" "all"
END
STYLEITEM "AUTO"
CLASS
END
END
END

<---myMap.map--->
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20100211/7f18aabb/attachment.html


More information about the mapserver-users mailing list