[OpenLayers-Users] objekts created
with vectorLayer.addFeature() aren't part of the insertRequest
Christopher Schmidt
crschmidt at metacarta.com
Mon Oct 26 12:34:18 EDT 2009
On Mon, Oct 26, 2009 at 02:30:05AM -0700, Marco Scheuble wrote:
>
> Hi all,
>
> problem solved!!! - And I think, I found a bug!
>
> After adding the feature to the layer, I had to set the state of this
> feature explizit to "Insert".
> ->
> editableLayer.features[editableLayer.features.length-1].toState("Insert");
> then it works fine!!!
>
> I think this should be done automatically, when adding a feature to a layer
> !?
This should not be done automatically. Many people will insert
'temporary' features or other similar types of features into a layer --
for visualization, different styles, etc. -- and want these types of
features to be in the layer, but not saved to the database.
It should, however, probably be better documented that if you want to
save a feature, and you create it yourself, you have to set an explicit
state. Where would you have looked for such documentation?
-- Chris
> Where can I post this, so that someone can fix it?
>
> -Marco
>
>
>
> Marco Scheuble wrote:
> >
> > Hi all,
> >
> > the following code adds a new feature to the layer "editableLayer".
> > The feature is added to the map and I can see it. But when I save this
> > layer, the added feature isn't sended to the WFS-server! Features, that I
> > additionally add with "OpenLayers.Control.DrawFeature" to this layer, are
> > stored!?
> >
> > here is my code:
> > editableLayer = new OpenLayers.Layer.Vector( 'Flächen', {
> > strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy ],
> > projection: gk,
> > styleMap: styles,
> > protocol: new OpenLayers.Protocol.WFS({
> > version: '1.1.0',
> > srsName: 'EPSG:31467',
> > url: '/geoserver/wfs',
> > featureNS : 'http://www.openplans.org/topp',
> > featureType: 'poly',
> > geometryName: 'the_geom'})
> > });
> >
> > var rectangle = new
> > OpenLayers.Bounds(3576418,5713156,3617581,5746487).toGeometry();
> > editableLayer.addFeatures(new OpenLayers.Feature.Vector(rectangle));
> > editableLayer.refresh();
> >
> > And this is the request sended to the server:
> > <wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" service="WFS"
> > version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs
> > http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
> >
> > If I edit the newly added feature, and then save it, it's part of the
> > request, but unfortunately inside of an update-statement :-(
> >
> > request after editing the feature:
> > <wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" service="WFS"
> > version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs
> > http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><wfs:Update
> > typeName="feature:poly"
> > xmlns:feature="http://www.openplans.org/topp"><wfs:Property><wfs:Name>the_geom</wfs:Name><wfs:Value><gml:Polygon
> > xmlns:gml="http://www.opengis.net/gml"
> > srsName="EPSG:31467"><gml:exterior><gml:LinearRing><gml:posList>3591881.3107142434
> > 5724345.692857157 3602105.89285714 5725059.928571432 3606212.748214286
> > 5733749.796428571 3591928.072185834 5732198.791084743 3591881.3107142434
> > 5724345.692857157</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></wfs:Value></wfs:Property><ogc:Filter
> > xmlns:ogc="http://www.opengis.net/ogc"><ogc:FeatureId/></ogc:Filter></wfs:Update></wfs:Transaction>
> >
> >
> > hopy someone can help me,
> > thanks in advance,
> > Marco
> >
>
> --
> View this message in context: http://n2.nabble.com/objekts-created-with-vectorLayer-addFeature-aren-t-part-of-the-insertRequest-tp3871958p3890950.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
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list