Help with WFS

Schuyler Erle schuyler at NOCAT.NET
Fri Aug 12 13:38:18 EDT 2005


* On 12-Aug-2005 at 10:34AM PDT, Kyle Mulka said:
> 
> I'm implementing a Google Maps WFS Interface. This will allow GIS people to
> plot and possibly query their data using the awsome web mapping tool that is
> Google Maps.
> 
> So, if anyone knows WFS well, and can give me details of how I should
> implement a parser for the GML files WFS creates, please help.

Hi, Kyle, here's a bit of code I wrote to take MapServer WFS output of
a Wi-Fi hotspot database as a demo for our new book. It uses the
JavaScript DOM API to parse out bits of point data from MS's GML.

-----

var features = document.getElementByTagName('featureMember');

for (var i = 0; i < features.length; i++) {
    var ssid, lat, lon;

    var featureNode = features[i];
    var ssidNode = featureNode.getElementByTagName('ssid');
    if (ssidNode)
	ssid = ssidNode[0].childNodes[0].nodeValue;
    else
	ssid = "unknown";

    var pointNode = featureNode.getElementByTagName('Point');
    var coordNode = pointNode[0].getElementByTagName('Coordinates');
    var coordinates = coordNode[0].childNodes[0].nodeValue;
    var lonlat = coordinates.split(",");
    
    lon = lonlat[0];
    lat = lonlat[1];

    // do something with lat, lon, and ssid 
}
---

I have no idea if it works, but it might get you started. Please keep
me posted!

SDE



More information about the mapserver-users mailing list