[OpenLayers-Users] Add Feature and Pan into View
soatley
shawn at niagarafalls.ca
Thu May 21 11:01:09 EDT 2009
Hello,
Does anyone know how to have the map pan when adding a feature to a vector
layer so that the entire feature is in view?
Here's my code so far that works:
//define the popup
infoPopup = new OpenLayers.Popup.FramedCloud("info",
mouseLoc,
null,
"<div
style=\"padding:5px;font-size:0.8em;\">Loading...</div>",
null, true, onPopupClose);
map.addPopup(infoPopup);
//load the url for the popup data
OpenLayers.loadURL(infoUrl, '', this, showTip);
In the showTip function, I parse the data that is returned, update the
content popup and create a feature. The feature coordinates (WKT) are
passed with the response.
var f = new OpenLayers.Format.WKT();
infoFeature = f.read(marker.find("points").text());
infoLayer.addFeatures([infoFeature], { style: "default" });
infoPopup.contentHTML = marker.find("result").text();
infoPopup.setContentHTML();
infoFeature.popup = infoPopup;
This code works great. If the popup is off the screen it pans into view.
Great! But, how can I do the same if the feature (a parcel) is partially
off the screen?
--
View this message in context: http://n2.nabble.com/Add-Feature-and-Pan-into-View-tp2952437p2952437.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list