[OpenLayers-Users] Extract/read attributes from GML
Ian A. Barkley
ian.barkley at catlinusa.com
Wed Nov 14 11:57:21 EST 2007
Also, you may want to look at the GeoJSON or JSON library in OpenLayers
and adding the JSON extension to geoserver. I used OpenLayers.XML in the
beginning, but the metadata that was returned was just too much for my
project. Caveat: if you add the JSON extension for geoserver, you must
always return "the_geom", or it won't work, period (at least with
geoserver v1.5.3).
-----Original Message-----
From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org]
On Behalf Of Christopher Schmidt
Sent: Wednesday, November 14, 2007 11:00 AM
To: springrider
Cc: users at openlayers.org
Subject: Re: [OpenLayers-Users] Extract/read attributes from GML
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:coordinate
> s")
>
> 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
More information about the Users
mailing list