Hi Mark: Personally I'd steer you to the simplified query templates as described here:
http://mapserver.org/development/rfc/ms-rfc-36.html This allows you to put everything in one place and better separates data from presentation. No more header/footer's. Plus you can have multiple presentations for the same layer. That said, the mapfile below doesn't have any queryable layers. There is no TEMPLATE defined for the one layer that is present. If you want to use the new style templating you'd do something like this: 1- Define an output format: OUTPUTFORMAT NAME 'my-template' DRIVER 'TEMPLATE' MIMETYPE 'text/html; subtype=compass' FORMATOPTION "FILE=templates/my-template.html" END 2- Optionally make it the default query format (otherwise you need to use qformat CGI parameter): WEB QUERYFORMAT 'my-template' ... END 3- Make layers queryable by adding something like: TEMPLATE 'void' 4- Write your template, for example my-template.html might look like: --- snip --- <!-- MapServer Template --> This is my template:<br/> [resultset layer="mjrroads"] [feature]<b>Type</b>: [TYPE][/feature] [/resultset] Done presenting layers. --- snip --- Steve From: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Mark Mirrlees Sent: Wednesday, March 20, 2013 10:45 AM To: mapserver-users@lists.osgeo.org Subject: [mapserver-users] query creation issues Hello everyone, I'm trying to create a query so I can query the roads/expressways from the map. I'm pretty sure I have created the headers and footers correctly but not sure...regardless i'm not entirely too sure where to stick the particular code in my .map file (shown below). I have bolded the code that I'm trying to incorporate into the .map file but not sure why it's not working. Thanks Mark # Map file created from QGIS project file C:/wwwroot/M_Mirrlees_Assign3/markassign3.qgs # Edit this file to customize for your map interface # (Created with PyQgis MapServer Export plugin) MAP NAME "QGIS-MAP" # Map image size SIZE 500 500 UNITS meters EXTENT -2400000 -900000 3100000 4000000 FONTSET "/wwwroot/fonts/fontset.txt" SYMBOLSET "/wwwroot/symbols/symbols.sty" PROJECTION "proj=lcc" "ellps=GRS80" "lat_0=49" "lon_0=-95" "lat_1=49" "lat_2=77" "datum=NAD83" "units=m" "no_defs" END # Background color for the map canvas -- change as desired IMAGECOLOR 0 100 250 IMAGEQUALITY 95 IMAGETYPE agg OUTPUTFORMAT NAME agg DRIVER AGG/PNG IMAGEMODE RGB END # Legend LEGEND IMAGECOLOR 255 255 255 STATUS ON KEYSIZE 18 12 LABEL TYPE BITMAP SIZE MEDIUM COLOR 0 0 89 END END # Web interface definition. Only the template parameter # is required to display a map. See MapServer documentation WEB # Set IMAGEPATH to the path where MapServer should # write its output. IMAGEPATH "/ms4w/tmp/ms_tmp/" # Set IMAGEURL to the url that points to IMAGEPATH # as defined in your web server configuration IMAGEURL "/ms_tmp/" # WMS server settings METADATA 'ows_title' 'QGIS-MAP' 'ows_onlineresource' 'localhost.com/cgi-bin/mapserv.exe?map=C:/wwwroot/M_Mirrlees_Assign3/global.map' 'ows_srs' 'EPSG:4326' END #Scale range at which web interface will operate # Template and header/footer settings # Only the template parameter is required to display a map. See MapServer documentation TEMPLATE 'C:/wwwroot/M_Mirrlees_Assign3/global.html' END SCALEBAR STATUS EMBED UNITS KILOMETERS INTERVALS 3 TRANSPARENT TRUE OUTLINECOLOR 0 0 0 END # End for scalebar QUERYMAP STATUS ON # sets the map to be queryable STYLE HILITE # the selected object is highligthed END # End for QueryMap WEB TEMPLATE global.html IMAGEPATH "/ms4w/tmp/ms_tmp/" IMAGEURL "/ms_tmp/" HEADER "/maps/M_Mirrlees_assign3/header.html" FOOTER "maps/M_Mirrlees_assign3/footer.html" EMPTY "/maps/M_Mirrlees_Assign3/blank.html" END #End for WEB LAYER NAME 'mjrroads' TYPE LINE DUMP false EXTENT -143.210462 39.001401 -50.461045 85.911094 DATA '../data/mjrroads.shp' METADATA 'ows_title' 'mjrroads' END STATUS default TRANSPARENCY 100 PROJECTION 'proj=longlat' 'datum=WGS84' 'no_defs' END CLASSITEM 'TYPE' CLASS NAME "default" EXPRESSION "" STYLE WIDTH 0.91 COLOR 201 157 32 END END CLASS NAME "TYPE = Expressway" EXPRESSION "Expressway" STYLE WIDTH 2.0 COLOR 255 0 0 END END CLASS NAME "TYPE = Primary Highway" EXPRESSION "Primary Highway" MAXSCALEDENOM 2500000 STYLE WIDTH 1.0 COLOR 0 0 0 END END END _______________________________________________ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users