[mapserver-users] Query Layer out of DB
Stephen Lime
steve.lime at dnr.state.mn.us
Wed Sep 26 15:30:11 PDT 2001
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
More information about the MapServer-users
mailing list