[OpenLayers-Users] boundedBy undefined with GML with defined
boundedBy
Spirifer
ready945 at gmail.com
Thu Jul 30 16:59:26 EDT 2009
Hello,
I'm trying to get the boundedBy of a whole feature collection (in this
example
there is only on feature).
I follow this exemple http://trac.openlayers.org/ticket/1613
var g = new OpenLayers.Format.GML.v2(options);
var features = g.read(response.responseXML || response.responseText);
// boundedBy will contain the boundary of the whole feature collection
// easy for zooming to the selection / collection
console.log(g.boundedBy);
The result in my log is: undefined
here is my script:
<script type="text/javascript">
function parseData(req) {
var format = new OpenLayers.Format.GML.v2({
featureType: "states",
featureNS: "http://www.openplans.org/topp",
geometryName: "the_geom",
xy: false
});
var features = format.read(req.responseXML || req.responseText);
console.log(features.boundedBy);
}
function load() {
OpenLayers.loadURL("owls1.xml", "", null, parseData);
}
</script>
The beginning of my owls1.xml:
"<?xml version="1.0" encoding="utf-8"?>
<wfs:FeatureCollection xmlns="http://www.opengis.net/wfs"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:topp="http://www.openplans.org/topp"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.openplans.org/topp
http://localhost:8080/geoserver/wfs?service=WFS&version=1.0.0&request=DescribeFeatureType&typeName=topp:states
http://www.opengis.net/wfs
http://localhost:8080/geoserver/schemas/wfs/1.0.0/WFS-basic.xsd">
<gml:boundedBy>
<gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:coordinates xmlns:gml="http://www.opengis.net/gml"
decimal="." cs="," ts="">-75.791435,38.44949
-75.045998,39.840008</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<gml:featureMember>
<topp:states fid="states.3">
<gml:boundedBy>
<gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:coordinates xmlns:gml="http://www.opengis.net/gml"
decimal="." cs="," ts="">-75.791435,38.44949
-75.045998,39.840008</gml:coordinates>
</gml:Box>
</gml:boundedBy>
... "
Thanks for your help,
Spirifer
--
View this message in context: http://n2.nabble.com/boundedBy-undefined-with-GML-with-defined-boundedBy-tp3358976p3358976.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list