Queries
Pericles S. Nacionales
nacional at CBS.UMN.EDU
Thu Jun 23 16:36:01 EDT 2005
Peter,
Check http://terrasip.gis.umn.edu/projects/tutorial/section3.html and
look at the map and template files for each example. I'm currently in
the process of updating the tutorial and it will make more sense when
I'm done... perhaps in the next two weeks.
Anyway, to setup a non-spatial query in MapServer (generating maps is a
form of query too!) you need to define a query template in each layer to
be queried. In addition, you might also want to define a header and
footer for each of the layer. Attached you will find the relevant
template files and a mapfile. Open the mapfile and have a look at the
layer named cities_poly and also the web object--that's where all the
query-related parameters are defined.
As for the interface, I don't know about Chameleon but in the MapServer
CGI world you invoke queries by changing the mode to query or nquery. I
suspect it would be the same thing with PHP/MapScript.
Good luck!
-Perry
Peter Kingsbury wrote:
> Hello list,
>
> I have been reading through various documentation for some time, on how to
> accomplish simple queries with the data set I have, on the Chameleon site I
> have in place.
>
> At this point, I am not sure which of the sites, documents, or manuals will
> lead me to my goal; may I request a pointer to a useful document which will
> describe how to setup the initial environment to enable querying?
>
> I apologize if this is vague, however I am just beginning to scratch the
> surface, hence I am reading as much as I can on the subject!
>
> Much thanks,
> - Peter
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20050623/d3bb526e/header.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20050623/d3bb526e/cities_footer.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20050623/d3bb526e/cities_header.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20050623/d3bb526e/cities_query.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20050623/d3bb526e/footer.html
-------------- next part --------------
#
# Start of map file
#
MAP
NAME EX3.3_
STATUS ON
EXTENT 201621.496941 -294488.285333 1425518.020722 498254.511514
SIZE 400 300
UNITS METERS
IMAGECOLOR 255 255 255
SHAPEPATH "../data"
SYMBOLSET "../symbols/symbols35.sym"
FONTSET "../fonts/fonts.list"
IMAGETYPE png24
#
# Projection definition, consult the PROJ.4 documentation for parameter discussion
#
PROJECTION
"init=epsg:2163"
END
#
# Start of web interface definition (including WMS enabling metadata)
#
WEB
HEADER '../templates/header.html'
TEMPLATE 'example3-3.html'
FOOTER '../templates/footer.html'
MINSCALE 1000
MAXSCALE 15000000
IMAGEPATH '/ms4w/tmp/ms_tmp/'
IMAGEURL '/ms_tmp/'
END
#
# Start of reference map
#
REFERENCE
IMAGE '../images/ugl_ref1.png'
SIZE 155 105
EXTENT 201621.496941 -294488.285333 1425518.020722 498254.511514
STATUS ON
MINBOXSIZE 10
MAXBOXSIZE 150
COLOR -1 -1 -1
OUTLINECOLOR 128 0 0
MARKERSIZE 8
MARKER 'star'
END
#
# Start of legend
#
LEGEND
KEYSIZE 12 12
LABEL
TYPE BITMAP
SIZE MEDIUM
COLOR 0 0 89
END
STATUS ON
END
#
# Start of scalebar
#
SCALEBAR
IMAGECOLOR 255 255 255
LABEL
COLOR 0 0 0
SIZE TINY
END
STYLE 1
SIZE 100 2
COLOR 0 0 0
UNITS MILES
INTERVALS 2
TRANSPARENT FALSE
STATUS EMBED
POSITION LR
END
#
# Start of LAYER DEFINITIONS ---------------------------------------------
#
LAYER # States polygon layer begins here
NAME states
DATA states_ugl
STATUS DEFAULT
TYPE POLYGON
PROJECTION
"init=epsg:4326"
END
CLASSITEM "CLASS"
CLASS
EXPRESSION 'land'
SYMBOL 0
COLOR 232 232 232
END
END # States polygon layer ends here
LAYER # MODIS raster layer begins here
NAME relief
DATA 'raster/shdrlfi020g_ugl.tif'
STATUS OFF
TYPE RASTER
OFFSITE 169 209 254
PROJECTION
"init=epsg:4326"
END
CLASS
NAME 'Shaded Relief'
KEYIMAGE 'graphics/relief_keyimage.png'
END
END # MODIS raster layer ends here
LAYER # MODIS raster layer begins here
NAME modis
DATA 'raster/mod09a12003161_ugl_ll_idxa.tif'
STATUS OFF
TYPE RASTER
OFFSITE 70 74 66
PROJECTION
"init=epsg:4326"
END
CLASS
NAME 'MODIS MOD09 Product'
KEYIMAGE '../graphics/modis_keyimage.png'
END
END # MODIS raster layer ends here
LAYER # LandSat WMS map from JPL
NAME landsat
TYPE RASTER
OFFSITE 0 0 0
STATUS OFF
CONNECTIONTYPE WMS
CONNECTION "http://mapus.jpl.nasa.gov/wms.cgi?"
METADATA
"wms_title" "US Landsat7 image mosaic"
"wms_name" "global_mosaic"
"wms_abstract" "Seamless mosaic of Landsat7 1999/2000. 1/2 arcsecond, pansharpened"
"wms_server_version" "1.1.1"
"wms_format" "image/jpeg"
END
PROJECTION
"init=epsg:4326"
END
# Unfortunately, this layer doesn't render properly when
# the CLASS object is defined. A new bug?
#CLASS
# NAME 'Landsat 7 ETM+'
# KEYIMAGE 'graphics/landsat_keyimage.png'
#END
END # LandSat WMS image ends here
LAYER
NAME cities_poly
GROUP cities
TYPE Polygon
STATUS on
DATA urban_ugl
HEADER '../templates/cities_header.html'
FOOTER '../templates/cities_footer.html'
TOLERANCE 3
CLASS
NAME 'Urban Areas'
TEMPLATE '../templates/cities_query.html'
COLOR 255 240 115
END # CLASS
PROJECTION
"init=epsg:4326"
END
END # LAYER
LAYER
NAME fedlands
TYPE Polygon
STATUS on
DATA fedlan_ugl
TOLERANCE 3
CLASS
NAME 'Federal Land'
TEMPLATE '../templates/fedland_query.html'
COLOR 164 96 89
OUTLINECOLOR 144 72 64
END # CLASS
PROJECTION
"init=epsg:4326"
END
END # LAYER
LAYER # Hydrography layer begins here
NAME hydro
TYPE POLYGON
STATUS ON
DATA hydrop_ugl
PROJECTION
"init=epsg:4326"
END
TOLERANCE 3
CLASSITEM 'FEATURE'
CLASS
NAME 'Lakes'
EXPRESSION /(^B|^C|^L|^R)./
TEMPLATE '../templates/hydro_query.html'
COLOR 72 64 254
END # CLASS
CLASS
NAME 'Rivers'
EXPRESSION 'Stream'
TEMPLATE '../templates/hydro_query.html'
COLOR 136 128 255
END # CLASS
CLASS
NAME 'Wetlands'
EXPRESSION 'Swamp or Marsh'
TEMPLATE '../templates/hydro_query.html'
COLOR 195 252 255
OUTLINECOLOR 195 252 255
SYMBOL 'circle'
SIZE 0
END # CLASS
END # LAYER
LAYER # County lines
NAME counties
TYPE LINE
STATUS ON
DATA co2000_ugl
CLASSITEM 'COUNTY'
CLASS
NAME 'County Boundary'
EXPRESSION /./
COLOR 245 245 245
END # CLASS
PROJECTION
"init=epsg:4326"
END
END # County lines end here
LAYER # ROADS LAYER
NAME cty_roads
GROUP roads
TYPE LINE
STATUS OFF
DATA roads_ugl
MAXSCALE 750000
PROJECTION
"init=epsg:4326"
END
TOLERANCE 5
CLASSITEM 'CLASS1'
CLASS
NAME 'Minor Arterial Roads'
EXPRESSION '3'
TEMPLATE '../templates/roads_query.html'
COLOR 165 165 165
END # CLASS
CLASS
EXPRESSION '4'
COLOR 210 210 210
END # CLASS
END # ROADS LAYER
LAYER # state highways begin here
NAME state_hwy
GROUP roads
MAXSCALE 1500000
STATUS OFF
DATA roads_ugl
TYPE LINE
FILTERITEM 'CLASS1'
FILTER '2'
TOLERANCE 5
CLASS
NAME 'Principal Arterial Roads'
TEMPLATE '../templates/roads_query.html'
STYLE
COLOR 255 0 0
SIZE 1
SYMBOL 'circle'
END
END
PROJECTION
"init=epsg:4326"
END
END # highways
LAYER # interstate highways begin here
NAME interstate
GROUP roads
# MAXSCALE 22500000
STATUS OFF
DATA roads_ugl
TYPE LINE
FILTERITEM 'CLASS1'
FILTER '1'
TOLERANCE 5
CLASS
NAME "Interstate Hwy."
TEMPLATE '../templates/roads_query.html'
STYLE
COLOR 128 0 0
# SIZE 2
# SYMBOL 'circle'
END
END
PROJECTION
"init=epsg:4326"
END
END # highways
LAYER # States line layer begins here
NAME states
DATA states_ugl
STATUS ON
TYPE LINE
CLASSITEM "CLASS"
CLASS
EXPRESSION 'land'
SYMBOL 'circle'
COLOR 64 64 64
SIZE 1
END
PROJECTION
"init=epsg:4326"
END
END # States line layer ends here
LAYER
NAME roads_anno
GROUP roads
MAXSCALE 750000
STATUS OFF
DATA roads_ugl
TYPE ANNOTATION
LABELITEM "SIGN"
CLASSITEM "CLASS1"
CLASS
EXPRESSION "3"
STYLE
COLOR 0 0 0 # dummy color
SYMBOL '../symbols/sthwy.png'
END
LABEL
MINFEATURESIZE 50
MINDISTANCE 150
POSITION CC
SIZE TINY
COLOR 0 0 0
END
END
CLASS
EXPRESSION "2"
STYLE
COLOR 0 0 0 # dummy color
SYMBOL '../symbols/ushwy.png'
END
LABEL
MINFEATURESIZE 50
MINDISTANCE 150
POSITION CC
SIZE TINY
COLOR 0 0 0
END
END
PROJECTION
"init=epsg:4326"
END
END # highway annotation
LAYER
NAME roads_anno1
GROUP roads
STATUS OFF
DATA roads_ugl
TYPE ANNOTATION
LABELITEM "SIGN"
CLASSITEM "CLASS1"
CLASS
EXPRESSION "1"
STYLE
COLOR 0 0 0 # dummy color
SYMBOL '../symbols/interstate.png'
END
LABEL
MINFEATURESIZE 50
MINDISTANCE 150
POSITION CC
SIZE TINY
COLOR 255 255 255
END
END
PROJECTION
"init=epsg:4326"
END
END
LAYER # Cities label layer begins here
NAME cities_label
GROUP cities
DATA urban_ugl
STATUS ON
TYPE ANNOTATION
MAXSCALE 750000
PROJECTION
"init=epsg:4326"
END
LABELITEM "NAME"
CLASS
COLOR -1 -1 -1
LABEL
COLOR 32 32 128
TYPE TRUETYPE
FONT arial-bold
SIZE 8
ANTIALIAS TRUE
POSITION CC
PARTIALS FALSE
MINDISTANCE 300
BUFFER 2
END # end of label
END # end of class
END # Cities label layer ends here
LAYER # States label layer begins here
NAME states
DATA states_ugl
STATUS ON
TYPE ANNOTATION
PROJECTION
"init=epsg:4326"
END
CLASSITEM 'CLASS'
LABELITEM 'STATE'
CLASS
EXPRESSION 'land'
COLOR -1 -1 -1
LABEL
COLOR 132 31 31
SHADOWCOLOR 218 218 218
SHADOWSIZE 2 2
TYPE TRUETYPE
FONT arial-bold
SIZE 12
ANTIALIAS FALSE
POSITION CL
PARTIALS FALSE
MINDISTANCE 300
BUFFER 4
END # end of label
END # end of class
END # States label layer ends here
# End of LAYER DEFINITIONS -------------------------------
END # Map File
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20050623/d3bb526e/example3-3.html
More information about the mapserver-users
mailing list