[mapserver-users] Query Layer out of DB
Alexander Pucher
pucher at atlas.gis.univie.ac.at
Thu Sep 27 01:36:20 PDT 2001
Steve,
sounds great to me, but:
a) can I do this with mapserver 3.4 ?
b) where to put/send the variable codelist ? Append it in the URL? Like
e.g.: http://path/to/mapserver.phtml?codelist=AT|DE|IT ? Doesn't work
like this!
The mapfile looks like this (it work, when I sustitute %codelist% with
e.g. AT|DE|IT - they turn red):
...
...
...
LAYER
NAME nut3
DESCRIPTION "nut3"
CLASSITEM "Nurgcd"
# LABELITEM "Arrgcdl0"
QUERYITEM "Nurgcd"
TYPE POLYGON
STATUS ON
DATA nut3
CLASS
EXPRESSION /%codelist%/
NAME "0"
COLOR 255 0 0
END
CLASS
EXPRESSION /DE|IT|LI/
NAME "1"
COLOR 188 137 137
END
CLASS
EXPRESSION /AT|FR|BE/
NAME "2"
COLOR 188 182 137
END
CLASS
EXPRESSION /DK|NL/
NAME "3"
COLOR 141 188 137
END
CLASS
EXPRESSION /CH|LU|SI/
NAME "4"
COLOR 137 175 188
END
CLASS
EXPRESSION /EUCON|EULAK/
NAME "4"
COLOR 210 210 210
END
HEADER "Nurgcd NURGNM Link"
TOLERANCE 1
QUERYITEM "NURGNM"
QUERY
EXPRESSION /./
TEMPLATE "ttt"
END
END
--------------------
mfg
ALEX
Stephen Lime wrote:
>Seems to me the easiest way to do this is to turn the results of the SQL query into a either an attribute query or a class expression that hilites the right polys. This assumes you have a primary key between the 2 systems, a county code or something. I'd recommend the class expression option since it's the most straight forward. 3.5 has a couple of nice features that make doing this sort of thing pretty easy. Basically you set up a map with 2 parts, layer descriptions that compose the background of the map and a single layer to use in displaying the right countries. That single layer is what you manipulate the class expression for. Set the status to OFF for that layer and set up a class like:
>
>CLASS
> EXPRESSION /%codelist%/
> ...
>END
>
>Then in your other app you'd create a variable that cats all the country codes together (i.e. id1|id2|id3) called codelist. MapServer CGI will substitute the value of codelist for %codelist% and there you have it, a dynamic expression. Be sure to turn the layer on.
>
>No need to go to MapScript on this one...
>
>Steve
>
>Stephen Lime
>Data & Applications Manager
>
>Minnesota DNR
>500 Lafayette Road
>St. Paul, MN 55155
>651-297-2937
>
>>>>Alexander Pucher <pucher at atlas.gis.univie.ac.at> 09/26/01 07:11 AM >>>
>>>>
>Hello,
>
>I want to explain my question with a little example.
>
>Let's presume, I have a map of Europe with all the european countries
>included. In addition to that, I have statistical data about the various
>countries - like population, area etc. - stored in a database system -
>say MySQL. I make a SQL query, showing me the 3 countries with the
>highest poulation figures (e.g. Germany, France, UK). The system gives
>me a button saying "Show in Mapserver". What I want to see is the map of
>Europe with the three countries hilited.
>
>I'm quite sure that this has to be done with a newLayerObj, that is
>simply put onto the "standard" layers. Can anybody give me some more
>detailed information about this. Any suggestions, code snippets, links
>or previously posted messages to mapserver-users-group would be great.
>
>mfg
>ALEX
>
--
________________________________________________________
Institut fuer Geographie und Regionalforschung
Universität Wien
Kartografie und Geoinformation
Departement of Geography and Regional Research
University of Vienna
Cartographie and GIS
Universitaetstr. 7, A-1010 Wien, AUSTRIA
Tel: (+43 1) 4277 48644
Fax: (+43 1) 4277 48649
E-mail: pucher at atlas.gis.univie.ac.at
FTP: ftp://ftp.gis.univie.ac.at
WWW: http://www.gis.univie.ac.at/karto
________________________________________________________
"The toughest fight, was with my wife." -- Muhammad Ali
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20010927/434eb7df/attachment.htm>
More information about the MapServer-users
mailing list