[mapserver-users] Clickable label
Basques, Bob (CI-StPaul)
bob.basques at ci.stpaul.mn.us
Tue Sep 9 06:35:35 PDT 2014
All,
It's probably not the cleanest way to approach it, but maybe a straight imagemap type approach. You use the four corners of the label bounding poly and send as an imagemap or json set or id query.
I think the bounding polys need to somehow be thought of as a ad-hoc data layer themselves. Is there a way of sub-selecting feature constructs (that were originated by mapserver, like centroids are, into a reusable (on the fly) dataset?
My immediate thoughts were to use a clientside imagemage (which is passe these days) and that is where the translation occurs for the bounding boxes, via the imagemap generation.
bobb
________________________________________
From: Lime, Steve D (MNIT)
Sent: Monday, January 20, 2014 9:43 AM
To: Basques, Bob (CI-StPaul); wiltomap; mapserver-users at lists.osgeo.org
Subject: RE: [mapserver-users] Clickable label
That or a UTFGrid. I don't believe that support (in master) handles labels but maybe it could. In UTFGrid context you wouldn't want to render characters anyway, only the bounding polygons. However, because the grid is rendered at a lower resolution than the related map label placement consistency might be the issue. --Steve
________________________________________
From: Basques, Bob (CI-StPaul)
Sent: Friday, January 10, 2014 6:15 PM
To: Lime, Steve D (MNIT); wiltomap; mapserver-users at lists.osgeo.org
Subject: RE: [mapserver-users] Clickable label
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