NQUERY mode again
DjwStone
D.Stone at ED.AC.UK
Mon Jun 26 08:16:26 PDT 2006
Hi David -- it's MapServer 4.8.3 (and PostgreSQL 8.0.7). Apologies for the
length of this; I've hacked a lot out, but hopefully nothing vital! Let me
know if you want details of the 5-table view 'saintloc' referenced in the
PostGIS layers' DATA definitions.
Thanks for looking at this,
Dave
MAP FILE:
MAP
IMAGETYPE PNG # output image format
EXTENT 54792 530130 470852 1211482
SIZE 600 600 # 600 by 600 pixel image output
IMAGECOLOR 180 180 250 # default colour (water)
SYMBOLSET "/var/www/html/saints/data/parish/symbol.list"
FONTSET "/var/www/html/saints/data/parish/font.list"
LEGEND
STATUS ON # separate legend from map image
END
SCALEBAR
STATUS ON # separate scalebar from map image
UNITS KILOMETERS
INTERVALS 3 # three sections to scalebar
POSITION LR # embed scalebar at lower right corner
TRANSPARENT TRUE # scalebar background
OUTLINECOLOR 0 0 0 # black outline
END
REFERENCE
STATUS ON
IMAGE "../reference_small.png"
EXTENT 54792 530130 470852 1211482
SIZE 100 131 # size in pixels
COLOR -1 -1 -1 # transparent
OUTLINECOLOR 255 0 0 # red border
END
WEB
TEMPLATE "saint1.html"
IMAGEPATH "/var/www/html/tmp/"
IMAGEURL "/tmp/"
LOG "/var/www/html/saints/saints.log"
END
QUERYMAP
STATUS ON
STYLE HILITE
COLOR 255 255 0
END
LAYER # Parish polygon layer begins here
NAME parish
DATA "../Scotland_cp_1890_area" # shapefile name
STATUS DEFAULT
TYPE POLYGON
# MAXSCALE 500000
# LABELITEM 'PARISH' # shapefile attribute providing map labels
# LABELMAXSCALE 2000000 # labels suppressed above this scale
# CLASSITEM 'PARISH' # shapefile attribute used in class
expressions
CLASS
NAME "Parish Boundaries"
STYLE
# COLOR 255 255 150
COLOR 255 255 255
OUTLINECOLOR 32 32 32
END
END
END # parish polygon layer ends here
LAYER # Parish labels layer begins here
NAME parish_labels
DATA "../Scotland_cp_1890_area" # shapefile name
STATUS OFF
TYPE ANNOTATION
LABELITEM 'PARISH' # shapefile attribute providing map labels
CLASS
LABEL
COLOR 255 255 255
OUTLINECOLOR 0 0 0
POSITION CC
MINFEATURESIZE 100
END
END
END # parish labels layer ends here
LAYER # query layer using the saintloc PostgreSQL view
CONNECTIONTYPE postgis
NAME saint_chdedlocs_C12
CONNECTION "user=erdb13 dbname=stdraft"
DATA "geom from (select dr, geom, stdname, reftostconf,
saintid, locationref, placename, deddlo, deddhi, dedicationtype, stdesc, oid
from saintloc where ((deddlo between 11010101 and 12001231) OR (deddhi
between 11010101 and 12001231)) AND dedicationtype = 'Church dedication' AND
stdname='%stname%') as foo using srid=27700"
STATUS OFF
DEBUG ON
TYPE POINT
TOLERANCE 25
HEADER "result_hdr.html"
FOOTER "result_ftr.html"
CLASS
NAME "Church dedications - 12C"
MINSCALE 2000000
TEMPLATE "result.html"
DEBUG ON
STYLE
SYMBOL "square"
SIZE 5
COLOR 0 255 0
OUTLINECOLOR 0 0 0
END
END
CLASS
NAME "Church dedications - 12C"
MAXSCALE 1900000
TEMPLATE "result.html"
STYLE
SYMBOL "square"
SIZE 10
COLOR 0 255 0
OUTLINECOLOR 0 0 0
END
END
END # test query layer
# Similar point layers for 13C – 16C church dedications
# Also 5 point layers for 12C – 16C altar dedications
TEMPLATE SAINT1.HTML:
<HTML>
<HEAD>
<script language="javascript">
function set_slists() {
var saintname, i, mode;
saintname = "[stname]"; mode = "[mode]";
i = 0;
while (document.dedicns.stnameopts.length > i) {
if (document.dedicns.stnameopts.options[i].value == saintname) {
document.dedicns.stnameopts.options[i].selected = true;
break;
}
i++;
}
i = 0;
while (document.dedicns.modeoptions.length > i) {
if (document.dedicns.modeoptions.options[i].value == mode) {
document.dedicns.modeoptions.options[i].selected = true;
break;
}
i++;
}
}
function choose_target() {
if (document.dedicns.modeoptions.options[1].selected) {
document.dedicns.target = "_blank";
} else {
document.dedicns.target = "_self";
}
return true;
}
</script>
</HEAD>
<BODY onload="set_slists();">
...
<FORM NAME="dedicns" METHOD=GET ACTION="/cgi-bin/mapserv" onsubmit="return
choose_target();">
<BR>
<INPUT TYPE="HIDDEN" NAME="imgxy" VALUE="[center]">
<INPUT TYPE="HIDDEN" NAME="imgext" VALUE="[mapext]">
<INPUT TYPE="HIDDEN" NAME="map" VALUE="[map]">
<INPUT TYPE="HIDDEN" NAME="savequery" VALUE="true">
<INPUT TYPE="HIDDEN" NAME="map_web_template" VALUE="result.html">
<INPUT NAME="img" TYPE="image" SRC="[img]" WIDTH="[mapwidth]"
HEIGHT="[mapheight]"
BORDER=10 ALT="Map Image">
[scalebar]
Legend<BR>
[legend]
<BR>
Select Pan/Zoom options: <BR>
Zoom In
<INPUT TYPE=RADIO NAME="zoomdir" VALUE=1 [zoomdir_1_check]>
Re-centre
<INPUT TYPE=RADIO NAME="zoomdir" VALUE=0 [zoomdir_0_check]>
Zoom Out
<INPUT TYPE=RADIO NAME="zoomdir" VALUE=-1 [zoomdir_-1_check]>
Zoom Size
<INPUT TYPE=RADIO NAME="zoomsize" VALUE=2>2
<INPUT TYPE=RADIO NAME="zoomsize" VALUE=4>4
<INPUT TYPE=RADIO NAME="zoomsize" VALUE=6>6
<INPUT TYPE=RADIO NAME="zoomsize" VALUE=8>8
<INPUT TYPE=RADIO NAME="zoomsize" VALUE=10>10
<p>
Select Layers to Display: <BR>
Press "CTRL" and Click to select more than one<BR>
<SELECT MULTIPLE NAME="layers" SIZE=5>
<!-- the list of layers to choose from -->
<OPTION VALUE="saint_aldedlocs_C12" [saint_aldedlocs_C12_select]> C12
altar dedications</OPTION>
<OPTION VALUE="saint_aldedlocs_C13" [saint_aldedlocs_C13_select]> C13
altar dedications</OPTION>
...
<OPTION VALUE="saint_chdedlocs_C15" [saint_chdedlocs_C15_select]> C15
church dedications</OPTION>
<OPTION VALUE="saint_chdedlocs_C16" [saint_chdedlocs_C16_select]> C16
church dedications</OPTION>
<OPTION VALUE="parish_labels" [parish_labels_select]> Parish
names</OPTION>
<OPTION VALUE="parish" [parish_select]> Parish boundaries</OPTION>
</SELECT>
<p>
Select name of saint to plot on map: <BR>
<select name='stname' size=6 id='stnameopts'>
<option value=''> -- please select from this list --</option>
<option value='All Saints'>All Saints</option>
<option value='Anand'>Anand</option>
<option value='Anne'>Anne</option>
...
<option value='Thomas of Canterbury'>Thomas of Canterbury</option>
<option value='Wynin'>Wynin</option>
</select>
<p>
Select map mode: <BR>
<SELECT NAME="mode" id='modeoptions' SIZE=2>
<OPTION VALUE="browse" [browse_select]> Browse</OPTION>
<OPTION VALUE="nquery" [nquery_select]> Query</OPTION>
</SELECT>
<INPUT NAME="ref" TYPE="image" SRC="[ref]" WIDTH="100" HEIGHT="131"
BORDER=1 ALT="Reference map">
<INPUT TYPE="SUBMIT" VALUE="Redraw/Update">
</FORM>
</CENTER>
</BODY>
</HTML>
TEMPLATE RESULT.HTML:
<!-- query template -->
<br>
Result no.: [lrn]<br>
Dedication Ref.: [dr]<br>
Dedication Type: [dedicationtype]<br>
Dedication date (range): [deddlo] - [deddhi]<br>
Saint Ref.: [saintid]<br>
Saint Name: [stdname]<br>
Description: [stdesc]<br>
Confidence: [reftostconf]%<br>
Location Ref.: [locationref] ([placename])<br>
TYPICAL OUTPUT FROM RESULT.HTML:
Query Metrics: Number of layers with results=1
Total number of results=44
Result no.: 1
Dedication Ref.: DE/JD/16
Dedication Type: Church dedication
Dedication date (range): - 13660601
Saint Ref.: ST/JD/39
Saint Name: Monan
Description: The principal source for St Monan is the Aberdeen Breviary.
Confidence: 100%
Location Ref.: LO/JD/9 (St Monans)
Result no.: 2
Dedication Ref.: DE/JD/16
Dedication Type: Church dedication
Dedication date (range): - 13660601
Saint Ref.: ST/JD/39
Saint Name: Monan
Description: The principal source for St Monan is the Aberdeen Breviary.
Confidence: 100%
Location Ref.: LO/JD/9 (St Monans)
.....
(etc. for 42 more copies!)
--
View this message in context: http://www.nabble.com/NQUERY-mode-again-t1848174.html#a5048876
Sent from the Mapserver - User forum at Nabble.com.
More information about the MapServer-users
mailing list