Opened 15 years ago

Closed 14 years ago

#266 closed defect (fixed)

Maptips Should Only Show for Visible Layers

Reported by: tnolte Owned by: madair
Priority: P2 Milestone: 2.2
Component: Widgets Version: 2.0 - beta
Severity: Major Keywords: maptips
Cc: tnolte Browser: All
External ID: Operating System: All
state: New

Description

If a layer is not visible, showing within the current scale, then Maptips shouldn't show. You could possibly add parameters to each <Maptip> section in the ApplicationDefinition that would control independently the min/max scale. That would only be necessary if someone needed Maptips to show independently from the layers scale settings. I'm not sure how this applies to MapGuide. I'm only aware of this needed for MapServer as I have not used MapGuide.

Change History (10)

comment:1 by tnolte, 15 years ago

Version: 1.1.12.0 - beta

I have looked at the code and attempted to fix this using the layer MapScript function isVisible(), however it is coming back as TRUE for some reason. I then proceeded to use the scale/scaledenom MapScript references only to find that these aren't set if the scale is not set in the mapfile on the layer level. Would have to go to the classes to figure out the max/min scale. I also found out that the Maptips.php file is creating a new instance of the oMap object which has no MapScript scale/scaledenom set, comes back as -1. Going to proceed to check the extent values and see if I can come up with a fix for this. Alternatively, this may require an addition to the Maptips.php widget file to be passing the extent or scale to the MapGuide/MapServer specific scripts.

comment:2 by tnolte, 15 years ago

So after further investigation it would seem that the MapServer Maptips.php script is in fact creating a completely new map object and it is created with the default mapfile extents. This means that with even being zoomed in the full original map extents are used. Looks like the Maptips script should be getting the current map extents or scale. Also I found that the JSON data that is being reported for MapServer layers that aren't visible at the current scale is wrong. It's reporting the the layer is "visible" which is not correct. Looks like I might need to open another ticket for that.

comment:3 by pagameba, 15 years ago

The visibility of layers is controlled on the client side and included in a call to mapserv to request specific layers to be drawn. Same with extent and image size. This means that the map is (almost) never updated to reflect the transient client side changes.

I think we should modify the Maptips request in Layers/MapServer/MapServer.js to pass the current extent and visible layers along with the other parameters around line 807, then modify the MapTips.php to use this to correctly set up the map object.

Does this sound like a reasonable approach?

comment:4 by tnolte, 15 years ago

That is the road I did start to go down. It took a little bit to figure out where to gather this information from. I do agree that this seems to be the best route. As far as what all to pass, I guess this is sort of a toss-up. My first thought was to pass the scale and/or extent then in the MapServer Maptips script do some querying of the specified Maptips layers and see if any of the given layers fall within the current scale. If so then only provide Maptips for those layers. However, if you just passed a list of what layers were currently visible then you could also just bump up the Maptips layers against that list to dictate whether to show the Maptips.

comment:5 by pagameba, 15 years ago

we might as well send along anything useful, I think the minimum will be either the size of the viewport and map extent or center and scale, and the visible layers. I would probably prefer the size of the viewport and map extent as scale could be calculated differently by OL and mapserver.

comment:6 by madair, 14 years ago

Milestone: Future2.1
Status: newassigned

comment:7 by madair, 14 years ago

Milestone: 2.12.2

comment:8 by madair, 14 years ago

Cc: tnolte added

tnolte, do you have a patch we can use to fix this one?

comment:9 by tnolte, 14 years ago

I'm sorry but I don't have a patch for this available. Unfortunately my job has changed and I no longer do GIS development. :-( I wish I had the time to work on this on the side but I don't.

comment:10 by madair, 14 years ago

Resolution: fixed
Status: assignedclosed

my testing of this with a Mapserver backend it looks like this has been fixed

Note: See TracTickets for help on using tickets.