[OpenLayers-Users] Way to get name of the feature attribute?

Arnd Wippermann arnd.wippermann at web.de
Fri Jan 22 13:48:58 EST 2010


Hi,

If you use an OGC conform WFS server, then you can use
REQUEST=DescribefeatureType
to get the attributes of the features. That are only the ones the server is
configured to return, not all the columns that are probaply in the database.

Arnd

-----Ursprüngliche Nachricht-----
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von paweluz
Gesendet: Freitag, 22. Januar 2010 12:39
An: users at openlayers.org
Betreff: [OpenLayers-Users] Way to get name of the feature attribute?


Hi

I am using WFS-T to add object to the database. Is there a way to get a name
of columns in that database. I mean how to get the name of the attribute. I
am using these code below to add new object to the database.

     drawControls = {
               	add_object:new OpenLayers.Control.DrawFeature(
                    zielona_wfs, OpenLayers.Handler.Path
                )}


	drawControls["add_object"].featureAdded = function(feature) {
                feature.layer.eraseFeatures([feature]);
                feature.geometry = new OpenLayers.Geometry.MultiLineString(
                    feature.geometry
                );
		selectedfeature=feature;
                feature.state = OpenLayers.State.INSERT;
                feature.layer.drawFeature(feature);
            } 

.............................

		function add_object() {		
			selectedfeature.attributes['Id']
=parseInt(document.getElementById("id_geometry").value);
			selectedfeature.attributes['Road'] =
document.getElementById("road_geometry").value;
			map.layers[1].commit();
			return false;
		}



As you can see I am using selectedfeature.attributes['Id']. I would like to
use instead of 'Id' some parameter of feature or wfs layer (zielona_wfs). Is
they a way to get to name of attributes (column in database) through WFS
layer. I would also like to say that this:

			var object_attributes = feature.attributes
                        for (var key in object_attributes)
			{
				document.write(key);
			}	


will not work because object_attributes is empty (because I am adding new
object to database, not editing existing one)

Does anyone have any idea??

Thanks,
Poul


--
View this message in context:
http://n2.nabble.com/Way-to-get-name-of-the-feature-attribute-tp4439540p4439
540.html
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