How to create a legend containing ONLY classes shown in current extents?

Michelle Schulze michelle at MARKSCHULZE.NET
Sat Feb 2 00:50:03 EST 2008


I have been working for the past several months on a map based entry for an
existing database.  I'm using ka maps for the tiling and for the layout,
because I don't have much programming experience and I want to try and make
it as simple as I can for myself.  I have my scripts written to retrieve the
data, and I have the layout looking the way I want it, but I have some
performance issues, and I cannot get the legend to do what I want it to do.

As an example, one of my maps covers North America, and the projects I am
displaying on the map (using shape files of various vintages) can cover
multiple territories/states down to only a few counties.  Some of the maps
contain 60-70  projects, grouped by vendor. I would like to have the legend
show only the classes that are visible within the current extents of the
displayed map.

I naively assumed that when the map extents were changed in a map file, the
 legend would only return entries for classes that were visible in the map
image.  I originally attacked this problem in ka maps by changing the map
extents used in legend.php, but when it didn't work, I ran the map file
directly through Mapserver and realized that the extent made no difference.
 Then, I searched through the listserve archives for help, but the last
posting I could find on this subject is from 2004 and the gist is that it
isn't supported in Mapserver.

Has this issue been addressed in subsequent releases of Mapserver?  Or is
there a way to customize without a lot of programming?

While I'm here, I'd also like to ask about tileindexing?  My data is all
contained in shape files.  For convenience, I'm trying to use files that
have already been created that cover the aoi of the project.  Depending on
the data type, the shape file are polygons, line or point files and each
project is contained in it's own shape file.  Is tileindexing even going to
be helpful for me?  I tried some sample sets using tileindexing and the
polygon shapes seem to work fine.  However when I tried indexing using the
point shapefiles, Mapserver appears to be retrieving every shape file in the
tileindex shape file for every layer.  Any advice would be helpful.

Thank you,
Michelle



More information about the mapserver-users mailing list