[mapserver-users] mapxy + scale / buffer not work!
Stephen Lime
steve.lime at dnr.state.mn.us
Wed Sep 5 14:04:53 PDT 2001
Hi Michael: You're correct, this doesn't work on 3.4, but will in 3.5 (currently doesn't). It's not
a technical issue rather one of priorities in getting things working. You can work around this
by not using a query map but rather adding a second layer to use in displaying the query
results. For this second layer you're going to modify the class expression dynamically to isolate
the chosen record and draw it special. You do this within an <img...> tag that normally would
be used to display the querymap. Here's how:
- add a second layer to your mapfile, it should reference the same data as you want to
query and define the class to draw the selected feature as you wish, the class item should
be 'regnrba'. Don't define a class expression. Place this layer AFTER the main layer and
set it's status to OFF.
- drop the query map from your mapfile
- add something like this to your template (assuming new layer is called foo)
<img src="/cgi-bin/mapserv.exe?map=[mapfile]&layer=foo&mapxy=[shpmidx]+[shpmidy]&buffer=xxxx&map_foo_class_expression=[REGNRBA]&mode=map[getlayers]">
What that call does is creates a map:
- centered on the shape
- with an extent defined by the value of buffer (could also use scale)
- preserves any layers that were already on using [getlayers]
- turns on the new layer "foo"
- sets the expression for the first CLASS in foo to be the value of the item REGNRBA
What the value for map_foo_class_expression should be will depend on what valid values in REGNRBA is. If
it's strictly a number then you have to enclose it in double quotes for mapserver to treat it correctly, just use
map_foo_class_expression=%22[REGNRBA]%22 instead. You could also use other unique column values to
isolate the record.
Hope this helps.
Steve
Stephen Lime
Internet Applications Analyst
Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937
>>> "Michael Achtzehn" <M.Achtzehn at cui.de> 09/05/01 09:53AM >>>
Hallo,
An apparent old problem, for which I could not discover a solution in the Mailing.
I would like to determine an object with one ID (here regnrba) ) from a data base to display.
With ITEMQUERY mode and using MAPXY=SHAPE I would like to show the result on certain scale, but BUFFER or SCALE parameter does nothing.
Where are the contents of the variable shapes defined - is ' shapes " a variable or a keyword for the map server? Do I have to make 'shapes' special entries for the
definition of in templete file?
Where is the mistake - how can I solve my problem?
(I work with mapserver 3.4 on Win NT.)
my data:
URL: http://ms_test.cui.de/cgi-bin/mapserv.exe?map=ms_demo/isab02.map&layer=lsa_tfb&mode=itemquery&item=regnrba&value=1105-41/15&mapxy=shapes;scale=50000
mapfile:
map
extent 4401328.5 5644860.0 4582087.0 5878911.5
imagecolor 255 255 255
name "isab02"
shapepath "data"
size 600 600
status on
symbolset "symbols/all.sym"
#MA fontset eingefügt für Beschriftung der Lables
fontset "font.set"
units meters
# 1 web isab01.html
web
footer "isab02_footer.html"
header "isab02_header.html"
imagepath "C:/Inetpub/wwwroot/ms_demo/tmp/"
imageurl "/ms_demo/tmp/"
template "isab02.html"
end
# 2 querymap hilite
querymap
STATUS ON
STYLE HILITE
COLOR 255 255 0
size 700 500
end
# 3 scalebar #none
scalebar
backgroundcolor 255 255 0
color 255 255 255
imagecolor 255 255 255
intervals 4
outlinecolor 0 0 0
size 200 7
status on
style 0
transparent true
units meters
# 1 label #none
label
backgroundcolor 0 0 0
color 255 255 0
size tiny
end
end
# 4 layer lsarb
layer
classitem "MERGE_RP"
data "lsarb"
# group "lsarb"
labelcache on
labelitem "MERGE_RP"
name "lsarb"
# postlabelcache true # Wenn Option aktiv erscheint Fläche immer oben
queryitem "MERGE_RP"
status on
type polygon
# 2 class {RP Dessau}
class
color 255 217 125
SYMBOL 2
expression "151"
name "RP Dessau"
outlinecolor 0 0 0
label
color 0 128 255
end # label
end
# 3 class {RP Halle}
class
color 255 251 195
expression "152"
name "RP Halle"
outlinecolor 0 0 0
label
color 0 128 255
end # label
end
# 4 class {RP Magdeburg}
class
color 183 223 134
expression "153"
name "RP Magdeburg"
outlinecolor 0 0 0
label
color 0 128 255
end # label
end
end
#
# 5 layer lsa_tfb
layer
name "lsa_tfb"
type polygon
status on
data "lsa_tfb"
header "lsa_tfb_header.html"
# 1 query #none
query
template "lsa_tfb_query.html"
end
minscale 10000
labelcache on
labelitem "REGNR_BA"
# postlabelcache true # wenn Option aktiv, kein Hiliting in der Abfrage!
# 2 class lsa_tfb_1
class
name "Tiefbauflaechen"
SYMBOL 0
color 230 221 251
outlinecolor 0 0 0
# 1 label #none
label
angle auto
antialias
backgroundcolor 250 250 150
buffer 2 #Größe des Labels (MA)
color 140 70 5
font "arial"
maxsize 12
minsize 7
position cr
size small
type truetype
end # label
end
end
# 6 reference graphics/reference.gif
reference
color -1 -1 -1
extent 4401328.5 5644860.0 4582087.0 5878911.5
image "graphics/reference.gif"
outlinecolor 255 0 0
size 120 120
status on
end
# 8 legend #none
legend
keysize 18 12
status on
# 1 label #none
label
color 0 0 89
size medium
type bitmap
end
end
end
_
query_templet:
<font size="+1" face="arial,helvetica"><b>
<html>
<head>
<title></title>
</head>
<body>
<p>Informationssystem Altbergbau</b></font> </p>
<table cellpadding="3" cellspacing="0" border="0">
<tr>
<td><img border="2" src="[img]"></td>
<!-- in dieser Variante nicht verwendet
<td><img border="2"
src="/cgi-bin/mapserv.exe?map=[map]&queryfile=C:\Inetpub\wwwroot\ms_demo/tmp/isab01[id].qy[get_layers]&mode=map&size=600+600"></td>
-->
</tr>
<tr>
<th align="center">Abfrageergebnis</th>
<!--
<th align="center">cached query</th>
-->
</tr>
</table>
</body>
</html>
Thank you
Michael Achtzehn
Dipl.-Ing. M. Achtzehn
CUI - Consultinggesellschaft für Umwelt und Infrastruktur
Eisenbahnstraße 10
06132 Halle
____________________
www.cui.de
Tel.: 0345 7742 749
Fax.: 0345 7742 754
More information about the MapServer-users
mailing list