A couple of newbie questions

kenboss kenboss at dilbert.dnr.state.mn.us
Thu Feb 17 14:59:40 EST 2000


Erich--

Of course, in your mapfile you've got a web template definition with at least 
this much defined:

WEB
  TEMPLATE surveys.html
END

Your surveys.html file drives your current pan/zoom interface through an html 
form.  In the simplest case, you need a button on the form that allows the user 
to specify whether they're just moving around on the map or trying to query a 
feature.  The variable the button controls is "mode".  When they're navigating 
the map, mode is set to "browse" (the default mode), and when they're querying 
features, mode is set to "query".  

The rest is handled in your map file.  To display and query both surveyed areas 
and the "holes" inside of them, you might have a layer like this in your 
mapfile:

LAYER
  NAME sites
  STATUS default
  DATA /data/archaeology/sites
  TYPE polygon
  CLASSITEM "survey_id"
  CLASS
    NAME "Real Survey Sites"
    EXPRESSION ([survey_id] > 0)
    SYMBOL 1
    COLOR 32 201 32
  END
  CLASS
    NAME "Doughnut Holes"
    EXPRESSION "0"
    SYMBOL 2
    COLOR 201 32 32
  END
  QUERYITEM "survey_id"
  QUERY
    EXPRESSION ([survey_id] > 0)
    template survey_detail.html
  END
  QUERY
    EXPRESSION "0"
    template not_surveyed.html
  END
END # Layer 


To display and query only surveyed areas, just remove a few lines from the above 
layer so that you end up with this:

LAYER
  NAME sites
  STATUS default
  DATA /data/archaeology/sites
  TYPE polygon
  CLASS
    NAME "Real Survey Sites"
    EXPRESSION ([survey_id] > 0)
    SYMBOL 1
    COLOR 32 201 32
  END
  QUERY
    EXPRESSION ([survey_id] > 0)
    template survey_detail.html
  END
END # Layer 


Note that I am a mapserver 3.2 user, and the expressions above are based on my 
reading of the online docs, not personal experience.  In the "old way of doing 
things", I would've used a regular expression like:

EXPRESSION "^[1-9]$|^[1-9][0-9]$"

to mean "any number from 1 to 99".  This is still a valid way to do things if 
you choose.

Your query template files will be full of regular html, except for where you 
need to swap in attributes from the shape that the user clicked on, where you'll 
have [THIS_ATTRIBUTE_NAME] and [THAT_ATTRIBUTE_NAME].

Hope this at least helps to get you started...

--Ken


> Hi,
>   Last weekend I finally got my own Mapserver application to work, at
> least to allow zooming and panning. I'm confused on quering and other
> things, still.
> 
> First:
> One of my layers (areas where archaeological surveys have been done) has
> internal polygons which are actually unsurveyed. Within the dbf file the
> value of SURVEY_ID for these is 0, all "real" polygons have a numeric code
> relating to a document number describing the survey.
> 
> Could someone show me a mapfile snippet that will only display polygons
> with SURVEY_ID > 0?
> 
> One of the other layers is the locations of reported archaeological sites,
> digitized as polygons. My users will want to be able to click on a site
> and get the information associated. The information is in a separate dbf
> file that can be linked to the coverage by a index number. 
> 
> What is the combination of mapfile information and html code that will
> make it possible for a user to click on a polygon, and get a listing of
> the associated record?
> 
> I hope these are simple...
> 
> Erich
> 
> ---------------------------------------------------------------------
> Erich Schroeder                    Phone: (217)785-0033
> Curator, Information Technologies  FAX:   (217)785-2857
> Illinois State Museum GIS Lab      Internet: erich at museum.state.il.us
> http://www.museum.state.il.us/ismdepts/anthro/staff/erich/erich.html
> ---------------------------------------------------------------------
> 




More information about the mapserver-users mailing list