[OpenLayers-Users] Change line and point

Alexandre Dubé adube at mapgears.com
Mon Nov 26 05:34:56 PST 2012


Hello,

   You can define your own onComplete method for your drag control.  It 
will be call everytime a feature is done dragging :

http://dev.openlayers.org/releases/OpenLayers-2.12/doc/apidocs/files/OpenLayers/Control/DragFeature-js.html#OpenLayers.Control.DragFeature.onComplete

   In it, you can save your features to your DB.  If you look at the 
HTTP protocol, you'll see a commit method you can use for this purpose.  
You can start there :

http://dev.openlayers.org/releases/OpenLayers-2.12/doc/apidocs/files/OpenLayers/Protocol/HTTP-js.html#OpenLayers.Protocol.HTTP.commit

HTH,

Alexandre


On 12-11-25 06:41 AM, adidas wrote:
> Hello! How to keep new coordinates in db when the user moved a point?
> So I create points:
> /        var layerNodes = new OpenLayers.Layer.Vector("Nodes", {//
> //                strategies : [new 
> OpenLayers.Strategy.BBOX({resFactor: 1.1})],//
> //                protocol   : new OpenLayers.Protocol.HTTP({//
> //                    url    : "get_layers.php?mode=GetNodesMarkers",//
> //                    format : new OpenLayers.Format.Text()//
> //                })//
> //            });//
> //            map.addLayer(layerNodes);/
>
> And how to make line change (it is necessary, that the user could 
> extend line) and to keep new coordinates in a DB?
> So i create the line:
> /lineLayer = new OpenLayers.Layer.Vector("Lines");//
> //    map.addLayer(lineLayer);//
> //    var line = new OpenLayers.Geometry.LineString(points);//
> //    line.transform(new OpenLayers.Projection("EPSG:4326"), new 
> OpenLayers.Projection("EPSG:900913"));//
> //    var lineFeature = new OpenLayers.Feature.Vector(line, null, 
> style_arr[CableLine_arr[k]['style']]);//
> //    lineLayer.addFeatures([lineFeature]);/
>
> Movement of lines and points I plan to do, as here: 
> http://openlayers.org/dev/examples/drag-feature.html
>
> Thanks for answers!
>
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users


-- 
Alexandre Dubé
Mapgears
www.mapgears.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20121126/e0f20884/attachment.html>


More information about the Users mailing list