highlighting a feature in mode=map

Fawcett, David David.Fawcett at STATE.MN.US
Tue Apr 10 12:32:19 EDT 2007


John, 

I have done this when I want to highlight a particular county in the
state.  To do this, I need to know the ID (FIPS) for the poly.  I create
a URL variable that is passed to mapserv in the url and then use that
variable in an expression in a class in the counties layer.  If you can
successfully use GID in an expression in your map file, you can do it
this way.

Here is an example LAYER:

LAYER
    NAME basemap
    STATUS DEFAULT
    TYPE POLYGON
    DATA 'county'
    CLASSITEM "COUNTY_FIP"
	CLASS 
       NAME "Low"
       EXPRESSION ('[COUNTY_FIP]' in '%group1%')
       OUTLINECOLOR 0 0 0   
       COLOR 255 204 204
    END
END

Here is a sample URL:

http://192.1.1.109/cgi-bin/mapserv?mode=map&map=/maps/emissions.map&grou
p1=001,003,005,007,009,011,013,015,017,019,021

This will highlight all of the counties that have a code listed in the
URL.  

This was clipped from an app where I create a thematic map of counties
and create the legend by passing all of the info in through the URL.  It
uses multiple URL vars and multiple classes.  

It is kind of a cool way to use MapServer.  The map file has no
attribute data associated with it beyond the feature IDs.  You can
define the high and low values for each thematic class on the client
side and then build both the map and a legend.  

To create the legend, I make a separate call to a different map file.
By passing in the thematic class value range as the name of its
respective class, the value range shows up in the legend.  

e.g.
http://192.1.1.109/cgi-bin/mapserv?mode=legend&map=/maps/emissionslegend
.map&map_basemap_class_1_name=1%20to%201000&map_basemap_class_2_name=100
0%20to%2010,000&map_basemap_class_3_name=10,000%20to%20100,000&map_basem
ap_class_4_name=100,000%20to%201,000,000


-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
Behalf Of Fischer, Brian
Sent: Tuesday, April 10, 2007 11:00 AM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-USERS] highlighting a feature in mode=map


Hi John,

I am not aware of a way to highlight a feature using mode=map, but
another technique I use is to create a transparent image that is stacked
on top of your main map image.  Then use some javascript that set's this
top image's src with a URL that looks something like this
http://douglas.mapmorph.net/cgi-bin/mapserv.exe?mode=nquerymap&map=/doug
las_mapmorph/mapmorph/douglas_queries.map&mapext=632381.525426633+155753
.54781032618+654398.6836237176+172737.2848856585&mapsize=678+523&layers=
parcel_query&mapshape=640694.7886986885+169847.12695123293+640694.788698
6885+169848.12695123293+640695.7886986885+169848.12695123293+640695.7886
986885+169847.12695123293&mapsize=678+523

I've found this technique works very well. You can see it working in one
of my applications at http://douglas.mapmorph.net/mapmorph/

Hope this helps,
Brian


Brian Fischer
Houston Engineering, Inc.
Maple Grove, MN
(763) 493-4522

-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
Behalf Of John Cole
Sent: Tuesday, April 10, 2007 10:00 AM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: [UMN_MAPSERVER-USERS] highlighting a feature in mode=map

Is it possible to highlight a feature when using mode=map?  I've tried
setting up the qlayer and qstring to select a feature by a gid, but I'm
not getting the desired results.

What are the recommended ways of highlighting a feature without
returning additional information about the feature (I have an ajax call
that has already returned that info).

Thanks,

John
--
View this message in context:
http://www.nabble.com/highlighting-a-feature-in-mode%3Dmap-tf3553524.htm
l#a9921526
Sent from the Mapserver - User mailing list archive at Nabble.com.



More information about the mapserver-users mailing list