[OpenLayers-Users] Trouble reading line features with format.GML

Phil Scadden p.scadden at gns.cri.nz
Mon Jun 15 19:15:31 EDT 2009


I am trying to read back which line features I have clicked. This 
response code for a getfeatureinfo works fine for points, but having 
trouble with lines.
                if(request.responseText) {
                    g =  new OpenLayers.Format.GML();
                    var features = g.read(request.responseText);
                    for (i = 0; i < features.length; i++) {
                            do stuff
                    }
Which I click on a line, I get back responsetext that looks like this 
below. It seems well formed to me
but g.read returns a zero-length feature collection. Do I need something 
else to read lines instread of points?


<?xml version="1.0" encoding="UTF-8"?><wfs:FeatureCollection 
xmlns="http://www.opengis.net/wfs" 
xmlns:wfs="http://www.opengis.net/wfs" xmlns:pdq="http://www.gns.cri.nz" 
xmlns:gml="http://www.opengis.net/gml" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.gns.cri.nz 
http://pdq-dev.gns.cri.nz:80/geoserver/wfs?service=WFS&amp;version=1.0.0&amp;request=DescribeFeatureType&amp;typeName=pdq:My 
Lines http://www.opengis.net/wfs 
http://pdq-dev.gns.cri.nz:80/geoserver/schemas/wfs/1.0.0/WFS-basic.xsd"><gml:boundedBy><gml:null>unknown</gml:null></gml:boundedBy><gml:featureMember><pdq:My 
Lines fid="My Lines.852"><pdq:the_geom><gml:MultiLineString 
srsName="http://www.opengis.net/gml/srs/epsg.xml#4253"><gml:lineStringMember><gml:LineString><gml:coordinates 
xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts=" 
">121.69522222,16.76155556 121.69166667,16.76294444 
121.68411111,16.76594444 121.67630556,16.76902778 
121.66822222,16.77236111 121.66038889,16.77536111 
121.65261111,16.77866667 121.64483333,16.78175 121.63705556,16.78497222 
121.6295,16.78794444 121.62180556,16.79130556 121.61402778,16.79422222 
121.60602778,16.79744444 121.59797222,16.80080556 
121.59016667,16.80397222 121.58244444,16.80705556 
121.57344444,16.81061111 121.56583333,16.81358333 121.558,16.81708333 
121.55,16.82008333 121.5425,16.82327778 121.53458333,16.82636111 
121.52697222,16.82952778 121.51838889,16.83305556 
121.51066667,16.83608333 121.50280556,16.83927778 
121.49516667,16.84213889 121.48747222,16.84530556 
121.47944444,16.84836111 121.47147222,16.8515 121.46383333,16.85458333 
121.45605556,16.85772222</gml:coordinates></gml:LineString></gml:lineStringMember></gml:MultiLineString></pdq:the_geom><pdq:LINE_NAME>L-16</pdq:LINE_NAME><pdq:RNG>166 
- 470</pdq:RNG></pdq:My Lines></gml:featureMember></wfs:FeatureCollection>"
-- 
Phil Scadden, Senior Scientist GNS Science Ltd 764 Cumberland St, 
Private Bag 1930, Dunedin, New Zealand Ph +64 3 4799663, fax +64 3 477 5232


Notice: This email and any attachments are confidential. If received in error please destroy and immediately notify us. Do not copy or disclose the contents.




More information about the Users mailing list