[OpenLayers-Users] How to recenter the map when drawing

Christopher Schmidt crschmidt at metacarta.com
Tue Feb 16 11:49:39 EST 2010


On Tue, Feb 16, 2010 at 08:47:37AM -0800, smartini wrote:
> 
> Hi Stephen.
> I am aware of what method I need to call on the map in order to center it.
> The problem is that I don't yet know how to intercept the event that occurs
> when a point is plotted such that I can then call: map.setCenter(evt.xy);
> [for instance]
> 
> Layer/Vector.js defines:
> beforefeatureadded", "beforefeaturesadded", "featureadded", "featuresadded",
> "beforefeatureremoved",   "featuresremoved", "beforefeatureselected",
> "featureselected", "featureunselected",  "beforefeaturemodified",
> "featuremodified", "afterfeaturemodified", "vertexmodified",
> "sketchstarted", "sketchmodified", "sketchcomplete", "refresh"
> 
> as the set of supported event types. None of these appear to fire when a
> point is plotted.

If you're using the Control.DrawFeature, I'm surprised that sketchmodified
doesn't:

Control/DrawFeature.js:75:"sketchmodified", {vertex: vertex, feature: feature}

Did you try that one?

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list