[OpenLayers-Users] Tooltip Name City...?

Scott Davis scott at davisworld.org
Thu Aug 16 12:08:20 EDT 2007


I'm working on a similar feature right now.

If you are trying to do this on a WMS layer, WMS supports a  
GetFeatureInfo. Possible limitations:
1. It requires a click, not a hover.
2. This roundtrips to the server rather than doing a quick in-memory  
thing
3. Your target is a single pixel if you are dealing with point data.  
If you are rendering it as a 20 pixel circle, the center point is the  
only thing that will trigger the GetFeatureInfo request.

WMS combines all layers into a flat sea of undifferentiated pixels.  
For hovering, the app can't tell the difference between a city point  
and the base layer it sits upon.

We're pulling items like this out of the base layer and into a Marker  
layer. Currently (OpenLayers 2.4) you have a couple of options for this:
1. Programmatically add each feature via the API
2. Add a Boxes layer
3. Add a Text layer (tab separated values)
4. Add a GeoRSS layer

<http://trac.openlayers.org/wiki/Documentation> has more info on these.

Once these elements are features, you should be able to detect a  
hover and pop up your tooltip.

I'm anxiously awaiting GeoJSON support -- it's coming to both  
OpenLayers and GeoServer soon, but it's not here today.

HTH,
s

Scott Davis
scott at davisworld.org



On Aug 16, 2007, at 6:14 AM, Carlos Fernando Gonçalves wrote:

> Hi list.
> Help me.
> I would like to know if he is possible to use Mouseover in  
> openlayers to representing the text you want shown inside the tip?
> The system with openlayers needs to show the name of the cities  
> when an user to pass with mouse on the map.
>
>
> Best regards,
> Carlos FG
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list