Hello,

If you look at OpenLayers/Feature/Vector.js, you'll see the "attributes" property :
http://dev.openlayers.org/releases/OpenLayers-2.12/doc/apidocs/files/OpenLayers/Feature/Vector-js.html#OpenLayers.Feature.Vector.attributes

It is where the attribute properties describing a feature are kept. Using Firebug/Any browser dev tool, you can inspect your layer feature object, using layer.features[0].attributes.

So, after drawing your feature you could open a popup and display a form containing the fields you want to have as your feature attributes. Once done, for each field you would do :
   feature.attribute['myfieldname'] = field.value.

That's basically what the [example] does. If you look at the [source] code, search for parseFeatureAttributesToForm and parseFormAttributesToFeature methods. This is pretty old stuff, but you should be able to understand it.

Let us know if you need more help. It'd be nice to have a small live demo of your application so that we could see what you're trying to do.

[example] http://dev4.mapgears.com/bdga/bdgaWFS-T.html
[source] http://dev4.mapgears.com/bdga/bdgaRoads.js

HTH,

Alexandre


On 12-11-15 04:04 AM, jannesm wrote:
Any ideas?

I found these links related to the issue, but most are unanswered or the
answer is a bit complex. Is there an easy way to do this?

     I want to edit corresponding postgresql data of a vector from
openlayers- how to do it?
http://gis.stackexchange.com/questions/1982/i-want-to-edit-corresponding-postgresql-data-of-a-vector-from-openlayers-how-to?rq=1
     How to edit Attributes on WFS Layer through Popup?
http://gis.stackexchange.com/questions/31753/how-to-edit-attributes-on-wfs-layer-through-popup
     How to edit feature attributes with openlayers?
http://gis.stackexchange.com/questions/30162/how-to-edit-feature-attributes-with-openlayers
     Modify WFS with OpenLayers
http://gis.stackexchange.com/questions/30081/modify-wfs-with-openlayers
     adding non spatial attributes using geoserver
http://gis.stackexchange.com/questions/32243/adding-non-spatial-attributes-using-geoserver?rq=1
     How to insert non-spatial data through WFS-T insert?
http://gis.stackexchange.com/questions/31915/how-to-insert-non-spatial-data-through-wfs-t-insert?rq=1

Also an example: http://dev4.mapgears.com/bdga/bdgaWFS-T.html#



--
View this message in context: 
http://osgeo-org.1560.n6.nabble.com/How-do-I-set-attributes-when-creating-vectors-using-WFS-T-tp5015040p5016525.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users


--
Alexandre Dubé
Mapgears
www.mapgears.com

_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to