[mapserver-users] Help with Mapserver and MySQL

Carlos Neves (LREC) cneves at lrec.pt
Fri Jun 28 04:04:07 PDT 2019


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