[mapguide-internals] fusion legend and sprited legend images
Walt Welton-Lair
walt.welton-lair at autodesk.com
Thu Dec 10 15:48:23 EST 2009
Hi Paul,
I was looking at your email and fusion ticket 131 (http://trac.osgeo.org/fusion/ticket/131), and I have a question / concern. Making a single request to generate an image strip containing all legend images is certainly much faster than making individual requests for the images, but it has the drawback that *all* images for *all* layers need to be initially generated. This alone can take considerable time for maps contains many layers. There are users that have maps containing 500+ layers, and many of the those layers are themed. So ultimately you might end up having to generate 1000's of legend images in the image strip.
In MapGuide a fix was made this summer to improve legend rendering performance in basic layouts (non-fusion). This was for ticket 1023 (https://trac.osgeo.org/mapguide/ticket/1023). The approach used there was different: legend images are only requested for layers which are visible, i.e. for top-level layers or for layers whose parent groups are all expanded. If a layer has a collapsed parent group, then those images are only requested when the user expands that group.
For any decent map containing 500+ layers, the bulk of these layers would be organized into groups, most of which would initially be collapsed. So the number of initial legend image requests ends up being reasonable with the MapGuide approach. But in the case of the fusion mechanism, my understanding is that all images would have to be generated up front. Or can we do something similar to MapGuide?
Walt
-----Original Message-----
From: mapguide-internals-bounces at lists.osgeo.org [mailto:mapguide-internals-bounces at lists.osgeo.org] On Behalf Of Paul Spencer
Sent: Thursday, October 08, 2009 1:06 PM
To: MapGuide Internals Mail List
Subject: [mapguide-internals] fusion legend and sprited legend images
I've been working on implementing http://trac.osgeo.org/fusion/ticket/131
which allows for the possibility of generating a sprite containing
all the legend icons and thus eliminating the individual calls to
generate legend icons for each layer/class. This is now implemented
and working for MapServer and the wiring is in place for it to work
with MapGuide.
This code provides a big apparent performance boost for maps with lots
of layers/themed layers by using a single image for all (or most)
legend icon images and using the CSS sprite technique for positioning
the image such that the correct sub-image is visible for the
appropriate layer/class/scale range.
If there is interest in having this feature supported for MapGuide
maps, I need some help from MapGuide gurus to modify fusion/Layers/
MapGuide/php/LoadScaleRanges.php to do the following:
1) create an image that contains all the icons for each layer/class/
scale range combination
* The image can be organized either vertically or horizontally
* the individual images need to be the same size within the strip
2) save the image to a web-accessible location and add the url and
size of each icon to the output json object, i.e.
"icons_url":"http:\/\/localhost\/ms_tmp\/4ace0feb_1a23_0.png",
"icons_width":18,
"icons_height":12
3) each scale range that has an image in the strip needs to add to its
json representation values for icon_x and icon_y which are the offsets
into the image that the icon can be found at
If a scale range doesn't have icon_x/_y then the legend will retrieve
the legend image using the existing mechanism
There is php code in MapServer's LoadScaleRanges.php which can do the
image manipulation to create the strip etc, just need to figure out
how to get MapGuide to generate the individual icons.
I am willing to work with someone on this code but I need a MapGuide-
savvy developer to figure out how to make the individual icons
Cheers
Paul
__________________________________________
Paul Spencer
Chief Technology Officer
DM Solutions Group Inc
http://research.dmsolutions.ca/
_______________________________________________
mapguide-internals mailing list
mapguide-internals at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-internals
More information about the mapguide-internals
mailing list