[OpenLayers-Users] Adding popups to vector features

Heidt, Christopher M. CHRISTOPHER.M.HEIDT at saic.com
Wed Dec 10 12:28:11 EST 2008


Lol, I assumed that since it inherited from feature it would be
available
but I now see that it is overwritten to return null.

QUOTE: "HACK - we need to decide if all vector features should be able
to create popups"

I'm going to have to vote yes ;p


-----Original Message-----
From: Christopher Schmidt [mailto:crschmidt at metacarta.com] 
Sent: Wednesday, December 10, 2008 12:22 PM
To: Heidt, Christopher M.
Cc: OpenLayers
Subject: Re: [OpenLayers-Users] Adding popups to vector features

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