[mapserver-users] Help with Mapserver and MySQL

Jeff McKenna jmckenna at gatewaygeomatics.com
Fri Jun 28 11:00:16 PDT 2019


Hi Carlos,

Give the JOIN documentation a read 
(https://mapserver.org/mapfile/join.html), specifically where it states 
in the first paragraph that:

   ---
   It is important to understand that JOINs are ONLY available once a 
query has been processed. You cannot use joins to affect the look of a map.
   ---

I remember creating those examples for that document, and that point is 
very important to remember (so you cannot use the JOIN object to affect 
your label, in other words).

Hope that helps,

(and happy early "Canada Day": 1st July we celebrate the birth of Canada)

-jeff




-- 
Jeff McKenna
MapServer Consulting and Training Services
https://gatewaygeomatics.com/



On 2019-06-28 8:04 AM, Carlos Neves (LREC) wrote:
> Hi List,
> 
> I need to connect a shapefile map to a mysql external  numeric table.
> 
> The goal is display in a mapserver map real time values  from a 
> meteorological  network M2M stations.
> 
> This is one of my mapfile with JOIN:
> 
> DATA "basins.shp"
> 
> JOIN
>                  NAME test
>                  CONNECTIONTYPE MYSQL
>                  CONNECTION  '192.168.3.20:user:passwd:meteodata'
>                  TABLE "meteo"
>                  FROM "BASINCODE"
>                  TO "code"
>                  TYPE ONE-TO-ONE
> 
> END # join
> 
> I have tried  LABELITEM "test_mysqlfield" or TEXT  ( [test_mysqlfield]) 
> but the result is  an unknown error and stops mapserv CGI. I have DEBUG 
> 5  level but no errors in log files.
> 
> So, I have tried another way with a OGR connection:
> 
> CONNECTIONTYPE OGR
> CONNECTION "basins.shp"
> DATA "SELECT * FROM basins LEFT JOIN 
> 'MYSQL:meteodata,host=192.168.3.20,user=user,password=passwd'.meteo ON 
> basins.BASINCODE = meteo.code"
> 
> now LABELITEM "mysqlfield" or TEXT ([mysqlfield])  doesn't have any 
> error, but the values display "0" (zero) in the Map label points.
> 
> Any idea? Any help would be much appreciated
> 
> Carlos
> 
> 




More information about the mapserver-users mailing list