[OpenLayers-Users] WFSDescribeFeatureType - how to use it???
Gabriel Nolasco
nolasco_gabriel at yahoo.com.br
Wed Mar 24 14:02:35 EDT 2010
Poul, try this:
var describeFeatureTypeRequest = OpenLayers.Request.GET({
url: 'http://localhost:8080/geoserver2_0_1/wfs?SERVICE=WFS&VERSION=1.1.0&REQUEST=DescribeFeatureType&TYPENAME=topp:bazadanych'
callback: parseFeatureTypes
});
var parseFeatureTypes = function(response) {
var featureTypesParser = new OpenLayers.Format.WFSDescribeFeatureType();
var responseText = featureTypesParser.read(response.responseText);
var featureTypes = responseText.featureTypes;
for(var i=0; i<featureTypes[0].properties.length; ++i) {
alert('attribute is named ' + featureTypes[0].properties[i].name);
alert('attribute is of type ' + featureTypes[0].properties[i].type);
}
};
Best regards,
Gabriel Nolasco
------------------------------
Message: 4
Date: Wed, 24 Mar 2010 06:10:21 -0800 (PST)
From: paweluz <paweluz at o2.pl>
Subject: [OpenLayers-Users] WFSDescribeFeatureType - how to use it???
To: users at openlayers.org
Message-ID: <1269439821755-4791176.post at n2.nabble.com>
Content-Type: text/plain; charset=us-ascii
Hi!
I was jus wandering if anyone please tell me how to use
WFSDescribeFeatureType class. I am thinking about getting the name of the
attributes from my database. I found a lot of examples like this:
var text =
' .........
' <extension base="gml:AbstractFeatureType">' +
' <sequence>' +
' <element name="geometry"
type="gml:MultiLineStringPropertyType" minOccurs="0" maxOccurs="1"/>' +
' <element name="SHAPE" type="string"/>' +
' <element name="SE_ANNO_CAD_DATA" type="string"/>' +
'
var parser = new OpenLayers.Format.WFSDescribeFeatureType();
var res = parser.read(text);
Ok, this works just great, if describefeature is written in string...
I want to get the name of my attributes from DescribeFeatureType via URL.
This is my url:
http://localhost:8080/geoserver2_0_1/wfs/DescribeFeatureType?version=1.1.0&typename=topp:bazadanych
If I do something like this:
var res =
parser.read("http://localhost:8080/geoserver2_0_1/wfs/DescribeFeatureType?version=1.1.0&typename=topp:bazadanych");
of course it will not work....
What is the way to read XML via URL and add it to the WFSDescribeFeatureType
class??
Can anyone please help me??
Regards,
Poul
____________________________________________________________________________________
Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100324/e2eaa299/attachment.html
More information about the Users
mailing list