SV: Re: [UMN_MAPSERVER-USERS] Select data from table to generate layer

Fawcett, David David.Fawcett at STATE.MN.US
Fri Sep 28 09:28:26 EDT 2007


So, going back to your original post, it sounds like you have a working layer of customers coming from MySQL.  You now want the user to be able to select a particular customer from a control (e.g. drop-down box) on the Web page and have only the geographic features associated with that customer show up on the map.  

One way that you could do this would be to create an expression or filter in the customers layer definition.  Instead of hard coding the expression to be something like '[customer]' = 'Ernstson', you would use variable substitution.  

So the expression would look something like '[customer]' = '%thecustomer%'.  Where the name of your control on the html page is 'thecustomer'.  

Disclaimer:  The syntax may not be correct, I haven't tested this.  Conceptually, it should work.

David.

-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On Behalf Of Henric Ernstson
Sent: Friday, September 28, 2007 6:01 AM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: [UMN_MAPSERVER-USERS] SV: Re: [UMN_MAPSERVER-USERS] Select data from table to generate layer


Tanks for a quick answer. 

I have used *.ovf files to select data from mySQL for the layers I have today to get data from the database and so far I have not got any problem yet, is it not recomended or so to use that method?



-----Ursprungligt meddelande-----
Från: "Umberto Nicoletti" <umberto.nicoletti at gmail.com>
Till: "Henric Ernstson" <henric at ernstson.nu>
Kopia: MAPSERVER-USERS at lists.umn.edu
Skickat: 07-09-28 09:14
Ämne: Re: [UMN_MAPSERVER-USERS] Select data from table to generate layer

The same has been cleaned up and added to the documentation here:

http://mapserver.gis.umn.edu/docs/reference/vector_data/mygis

Umberto

On 9/28/07, Umberto Nicoletti <umberto.nicoletti at gmail.com> wrote:
> Henric,
> first of all you need to make the mysql accessibile to mapserver by 
> converting coordintes into a valid mygis geometry. Unfortunately there 
> is not much documentation on mysql around, but I could gather the 
> following by looking at the source of mapmygis.c:
>
>
> Standard ways of specifiying are :
> (1) 'geometry_column from geometry_table'
> (2) 'geometry_column from (&lt;sub query&gt;) as foo using unique 
> &lt;column name&gt; using SRID=&lt;srid#&gt;'",
>
> NOTE: for (2) 'using unique' and 'SRID=' are optional, but its highly 
> recommended that you use them!!!
>
> The most common problem with (1) is incorrectly uploading your data. 
> There must be an entry in the geometry_columns table.  This will be 
> automatically done if you used the shp2mysql program or created your 
> geometry column with the AddGeometryColumn() MYGIS function.



More information about the mapserver-users mailing list