[OpenLayers-Users] How to read GML attributes

jmf roig at dtec.es
Wed Apr 22 12:49:27 EDT 2009


Hi, 

My main purpose at this moment is to use openlayers to show interactive
(onclick, onmouseover) point feature layers with data from oracle spatial.
Every layer has its simbology (icon). Then I need to get not only geometry
but also some feature data, including layer name, feature id, ...

I use: 

openLayers.events.register('moveend',this,_mapMoveEnd);

to capture "move end" event to refresh my interactive layers everytime map
changes (zoom, pan, ...). Inside _mapMoveEnd function I do an AJAX request
to get layer data in GML format. 

Exemple of Oracle spatial query generates:

<Element xmlns:gml="http://www.opengis.net/gml">
<Name>Test name</Name>
<Id>203</Id>
<Layer>Test layer</Layer>
<gml:geometryProperty>
<gml:Point srsName="SDO:82341" xmlns:gml="http://www.opengis.net/gml">
         <gml:coordinates decimal="." cs="," ts="
">453035.87675187894,4600288.721536965,0</gml:coordinates>
</gml:Point>
</gml:geometryProperty>
</Element>

where "Name" and "Id" are feature attributes.

Now I need to read this response text to get an array of feature objects.
Then I will add the features to corresponding vector layers previously
created. 

My first question is: How to read this GML content? 

I try with:

features =  new
OpenLayers.Format.GML.v2(gmlOptionsIn).read(sRequestResponseText);

But it does not work.

Other question is: Is this the best way to my main purpose?

Thanks in advance.
jmf






-- 
View this message in context: http://n2.nabble.com/How-to-read-GML-attributes-tp2677348p2677348.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list