[OpenLayers-Users] Extract/read attributes from GML
Arnd Wippermann
arnd.wippermann at web.de
Wed Nov 14 12:35:36 EST 2007
Hi,
propably you have problems with the namespaces. This is, what I get when I
load the gml with IE6:
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and
then click the Refresh button, or try again later.
----------------------------------------------------------------------------
----
Reference to undeclared namespace prefix: 'wfs'. Error processing resource
'http://www.nabble.com/file/p13750828/gml.xml'. ...
<wfs:FeatureCollection xsi:schemaLocation="http://www.fao.org/fi
http://193.43.36.238:8282/geoserver/wfs/DescribeFeatureT...
Mit freundlichen Grüssen
Arnd Wippermann
http://gis.ibbeck.de/ginfo/
-----Ursprüngliche Nachricht-----
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von springrider
Gesendet: Mittwoch, 14. November 2007 17:44
An: users at openlayers.org
Betreff: Re: [OpenLayers-Users] Extract/read attributes from GML
Thanks for your answer
I think i was not clear, I used to be a XML/XSL developper so i wanted to
access this specific tag. After browsing the different examples and mainly
the GMLparser example, i found some answers. I can obtain using OL code the
bouding box of my polygon directly.
This is a my current code:
g = new OpenLayers.Format.GML();
features = g.read(req.responseText);
var bounds = features[1].geometry.getBounds();
It works fine with the XMLs available for this OL example but with my GML, i
always have features.length=0. By doing Alert(req.responseText), i obtain
effectively my GML but no features are considered in it. In attachment, you
will find my GML: http://www.nabble.com/file/p13750828/gml.xml gml.xml .
I really hope you can help me.
Thanks
Sylvain
Christopher Schmidt-4 wrote:
>
> On Wed, Nov 14, 2007 at 07:17:08AM -0800, springrider wrote:
>>
>> Good morning
>>
>> I would be interested to extract/read text within some tags
>> (wfs:FeatureCollection\gml:boundedBy\gml:Box\gml:coordinates) from my
>> GML. I am now struggling trying to write the correct syntax. I tried
>> something like
>> that:
>> var myGml= new
>> OpenLayers.Layer.GML("myGML","http://193.43.36.238:8282/geoserver/wfs
>> ?request=GetFeature&typename=fifao:Fao_areas&cql_filter=F_AREA=27");
>> var myExtent=
>> myGml.read("wfs:FeatureCollection\gml:boundedBy\gml:Box\gml:coordinat
>> es")
>>
>> But it is not correct.Could you please help me? I would then use this
>> text to define the extent of my map.
>
> This isn't going to do what you want it to do.
>
> 1. None of the OpenLayers libraries include support for xpath like
> navigation of XML documents.
> 2. The GML parser returns features; additional metadata from the
> document is ignored.
> 3. The Layer is just about displaying data; you're more likely to want
> to use the Format (but it still won't do what you want.)
>
> You'll probably want to use the Format.XML class to load the data, and
> use standard DOM methods to manipulate the loaded XML, or the
> Format.XML specific getElementsByTagNameNS and the like.
>
> OpenLayers is a map library, rather than a geodata management
> framework, so it doesn't provide the tools to do what you want easily,
> as far as I'm aware.
>
> Regards,
> --
> Christopher Schmidt
> MetaCarta
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
--
View this message in context:
http://www.nabble.com/Extract-read-attributes-from-GML-tf4805707.html#a13750
828
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users
More information about the Users
mailing list