[mapserver-users] Clickable label

Basques, Bob (CI-StPaul) bob.basques at ci.stpaul.mn.us
Fri Jan 10 16:15:59 PST 2014


Steve,

I've been thinking on this thread since it started, I wonder, could you use a imagemap template from Mapserver, but populate it with the Label bounding polygons?

bobb


________________________________________
From: mapserver-users-bounces at lists.osgeo.org [mapserver-users-bounces at lists.osgeo.org] on behalf of Lime, Steve D (MNIT) [Steve.Lime at state.mn.us]
Sent: Friday, January 10, 2014 4:14 PM
To: wiltomap; mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] Clickable label

 This can't be done with stock MapServer. Labels are dynamic by nature and are the product of a map raw while queries work off the base data. The bridge between the map and a query is a conversion from pixels to map coordinates based on map size and extent.

You might be able to pull this off using MapScript. For a query you'd have to do things in two stages:

  1) Draw the map (in memory) based on the map the user interacted with (same extent, size and set of layers) so that a label cache is created.
  2) Search the label cache based on the query point and based on that pull the appropriate feature.

I don't know if step 2 is feasible or not. You used to be able to loop through it, not sure about now.

There might be other ways using an image where you render text and label backgrounds using the same color, a color that you could map back to a feature id. The map would basically contain label polygons in a raster you could, in turn, query that raster using point and retrieve a feature id. I have doubts that you could match the first image to the second so this would be a huge long shot.

Steve

-----Original Message-----
From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of wiltomap
Sent: Friday, January 10, 2014 2:17 AM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] Clickable label

Hello all,

I have to display labels instead of points on a layer. The labels rely on an attribute value. I would like to click on the label to make an attribute windows open up. So far, no problem with mapfile configuration...

The only thing is that the attribute window opens up when I click right in the middle of the label. I can use TOLERANCEUNITS and TOLERANCE parameters in the mapfile to enlarge the clickable area BUT this means that I can also click next to the label and get the attribute window, which I don't want to...

My purpose is to get the attribute window whereever I click on the label (any part of it) and not if I click next to it. Would you think about a solution to that ?

I enclose a scrennshot of the mapfile I have worked out so far.


Many thanks in advance,

Thomas


<http://osgeo-org.1560.x6.nabble.com/file/n5097281/mapfile_label.jpg>



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Clickable-label-tp5097281.html
Sent from the Mapserver - User mailing list archive at Nabble.com.
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users




More information about the mapserver-users mailing list