[OpenLayers-Users] Adding popups to vector features

Christopher Schmidt crschmidt at metacarta.com
Wed Dec 10 12:22:14 EST 2008


On Wed, Dec 10, 2008 at 12:19:42PM -0500, Heidt, Christopher M. wrote:
> I have a vector feature that is created by reading in wkt.
> I want to add a popup to it.
> 
> To do that I need:
> feature.data.popupSize = ...
> feature.data.popupContentHTML = ...
> feature.lonlat = ...
> 
> First two are easy, third one not so much.
> Too bad the wkt parser doesn't add a central lonlat to the feature.

Vector features don't have a createPopup method, so I'm not really
sure that this is going to do what you want. Can you explain how you
think this will work?

Anyway, setting the lonlat is simple: feature.lonlat =
feature.geometry.getBounds().getCenterLonLat();

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list