[OpenLayers-Users] OL + database

ngreen n13green at gmail.com
Thu Feb 18 15:30:04 EST 2010


Thank you. That does fill in some gaps.

I'm trying to keep this simple for these friends though, so I'll probably
stick to the mySQL database they currently have.

I have made a bit of progress on this - passing map coords to form fields -
but am stuck on two points.

The below code will pass a dragged point's lat and lon to the relevant form
field. My two questions are:

1) Why does the Ajax "onComplete" work here but not OL's "mouseup", "up"
etc.?

2) How do I make this work for creating new points and lines? I've tried
copying this method but changing the onComplete to onCreate (and for lines
changing feature.geometry.x/y to feature.geometry.linestring) but had no
luck.

			controls = {
				point: new OpenLayers.Control.DrawFeature(pointLayer,
						OpenLayers.Handler.Point),
				line: new OpenLayers.Control.DrawFeature(lineLayer,
						OpenLayers.Handler.Path),
				polygon: new OpenLayers.Control.DrawFeature(polygonLayer,
						OpenLayers.Handler.Polygon),
				dragpoint: new OpenLayers.Control.DragFeature(pointLayer, {onComplete:
onCompleteMovePoint})
                };

                for(var key in controls) {
                    map.addControl(controls[key]);
                }

                document.getElementById('noneToggle').checked = true;
            }
						
			function onCompleteMovePoint(feature) {
				if(feature) {       
                // replace coordinate values in feature attributes
                var pointX = feature.geometry.x;
                var pointY = feature.geometry.y;
				document.editpoint.lat.value = pointX;
				document.editpoint.lon.value = pointY;
				}
			}
-- 
View this message in context: http://n2.nabble.com/OL-database-tp4588879p4594162.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list