-A layer that contains multiple features - I want to draw new features with new OpenLayers.Control.DrawFeature and to add them to my layer.
var control = new OpenLayers.Control.DrawFeature(layer,OpenLayers.Handler.Polygon);control.events.register('featureadded', control, function(f) { f.feature.state = OpenLayers.State.INSERT; f.feature.attributes.Geo_ID = 794; saveStrategy.save(); }); When the feature is added, a xml file is sent to the geoserver with the following content:
363183.0625 5770740.875 363192.0625 5770755.375 363177.5625 5770764.375 363168.5625 5770749.875 363183.0625 5770740.875794The coordinates are not saved in the geoserver, only the feature:Geo_ID Element.
If I choose an existing Element to insert in the geoserver Database instead:
control.events.register('featureadded', control, function(f) { layer.features[0].state = OpenLayers.State.INSERT; f.feature.state = OpenLayers.State.INSERT; f.feature.attributes.Geo_ID = 795; saveStrategy.save(); }); I get the following XML in the Request:
363273.29099999997 5770863.855 363273.177000001 5770864.300999998 363274.1561700017 5770864.5512810005 363274.2701699999 5770864.105281 363273.29099999997 5770863.855795 And the coordinates DO get inserted in the geoserver DB.
I see one major difference between these two XMLs:
the insertion XML of an existing Element of the layer contains two more tags:
and
How do I make the application know that the features added by drawing a polygon are to be treated the same way and put in the same format as the features that already exist in the Database?
أكثر...
var control = new OpenLayers.Control.DrawFeature(layer,OpenLayers.Handler.Polygon);control.events.register('featureadded', control, function(f) { f.feature.state = OpenLayers.State.INSERT; f.feature.attributes.Geo_ID = 794; saveStrategy.save(); }); When the feature is added, a xml file is sent to the geoserver with the following content:
363183.0625 5770740.875 363192.0625 5770755.375 363177.5625 5770764.375 363168.5625 5770749.875 363183.0625 5770740.875794The coordinates are not saved in the geoserver, only the feature:Geo_ID Element.
If I choose an existing Element to insert in the geoserver Database instead:
control.events.register('featureadded', control, function(f) { layer.features[0].state = OpenLayers.State.INSERT; f.feature.state = OpenLayers.State.INSERT; f.feature.attributes.Geo_ID = 795; saveStrategy.save(); }); I get the following XML in the Request:
363273.29099999997 5770863.855 363273.177000001 5770864.300999998 363274.1561700017 5770864.5512810005 363274.2701699999 5770864.105281 363273.29099999997 5770863.855795 And the coordinates DO get inserted in the geoserver DB.
I see one major difference between these two XMLs:
the insertion XML of an existing Element of the layer contains two more tags:
and
How do I make the application know that the features added by drawing a polygon are to be treated the same way and put in the same format as the features that already exist in the Database?
أكثر...