[OpenLayers-Users] How to insert that I digitized Feture in my WFS layer?

Christopher Schmidt crschmidt at metacarta.com
Wed Nov 19 10:36:59 EST 2008


On Wed, Nov 19, 2008 at 01:58:21AM -0800, ironbar wrote:
> 
> Dear all,
> Here is a snippet of my code:
> 
> 
> var wfsl= new OpenLayers.Layer.WFS( "MY WFS",
> 			                    "http://localhost/geoserver/wfs?",
> 			                    {typename: 'topp:mywfs'},
>                                                        { typename:
> 'topp:mywfs'  });
> 
>           
> var wff= new OpenLayers.Format.WFS({layerName:'topp:mywfs'},wfsl);
> 				
> feature.state = OpenLayers.State.INSERT;
> 
> wff.insert(feature);
> 
> I simply want to insert the feature in my wfs layer but what I get is
> "An attempt was made to create or change an object in a way which is
> incorrect with regard to namespaces" code: 14"

It's not clear what you mean when you say you want to insert the feature
-- do you want to save the current state of the layer to the server? or
do you want to add a feature to your local layer?

Once you've added a feature to your local layer (via.addFeatures([])),
you can call layer.commit(), which will save t the server for you. You
should not need to work with the Format directly.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list