Thematic map using MySQL

joÿffffffffffe3o Antunes bluetuna_goes_skying at YAHOO.CO.UK
Wed Feb 9 05:57:16 EST 2005


Dear list partners,

In the last few days I have been trying to link my map file to a table in a MySQL database.
I must say I haven't had much success finding documentation on how to do this...
So I would like to ask for some help.

So far, the map files I used are:

 LAYER
     NAME comuni
     TYPE POLYGON
     STATUS DEFAULT
  LABELITEM 'Nomecomune'
   CONNECTIONTYPE OGR
   CONNECTION "C:\Programmi\Apache Group\Apache\htdocs\abruzzo\maps\data\comuni_abruzzo_gb.shp"
        DATA "SELECT * FROM comuni_abruzzo_gb LEFT JOIN 'ODBC:prova'.zzz ON comuni_abruzzo_gb.Id = zzz.ID"

  CLASSITEM FIELD
  CLASS
        NAME '<3'
     EXPRESSION ([FIELD] < (3))
        STYLE
          OUTLINECOLOR 255 255 255
          COLOR 215 050 085
        END
   TEMPLATE void
  END
  CLASS
        NAME '<6'
     EXPRESSION ([FIELD] < (6))
        STYLE
          OUTLINECOLOR 255 255 255
          COLOR 215 150 085
        END
   TEMPLATE void
  END
  CLASS
        NAME '<10'
     EXPRESSION ([FIELD] < (10))
        STYLE
          OUTLINECOLOR 255 255 255
          COLOR 215 250 085
        END
   TEMPLATE void
  END

 END

FIELD is the field according to witch values I want to make my thematic map. These values will change allong the time.
This example works perfectly with an ODBC for an Access Database. I instaled and configured ODBC for my SQL, but still it does not work. I get this message:

Warning: [MapServer Error]: msDrawMap(): Failed to draw layer named 'comuni'. in c:\programmi\apache group\apache\htdocs\abruzzo\_test_odbc.php on line 6

Warning: [MapServer Error]: msOGRFileOpen(): ExecuteSQL(SELECT * FROM comuni_abruzzo_gb LEFT JOIN 'ODBC:prova'.zzz ON comuni_abruzzo_gb.Id = zzz.ID) failed. Unable to initialize ODBC connection to DSN prova, [MySQL][ODBC 3.51 Driver]Access denied for user 'ODBC'@'localhost' (using password: NO) in c:\programmi\apache group\apache\htdocs\abruzzo\_test_odbc.php on line 6

Fatal error: Call to a member function on a non-object in c:\programmi\apache group\apache\htdocs\abruzzo\_test_odbc.php on line 7

As if my configuration for the ODBC MySQL was ignored.. Within this configuration I am using a valuable mysql user and an existent password. Here i get a message as if I was trying to get into the system with no settings, user and pass by default.

Anyway, I also tried to make this connection this way:

 LAYER
     NAME comuni
  DATA comuni_abruzzo_gb
     TYPE POLYGON
     STATUS DEFAULT
  LABELITEM 'Nomecomune'
  JOIN
   CONNECTIONTYPE mysql
   CONNECTION "server:'localhost' user:'tuna' pass:'caparica' database:'abruzzo'"
#          DATA "SELECT * FROM comuni_abruzzo_gb LEFT JOIN 'ODBC:abr_2'.zzz ON comuni_abruzzo_gb.Id = zzz.ID"
   NAME "TM"
   TABLE zzz
   FROM Id
   TO ID
   TYPE SINGLE
  END
     CLASSITEM FIELD
  CLASS
        NAME '<3'
     EXPRESSION ([FIELD] < (3))
        STYLE
          OUTLINECOLOR 255 255 255
          COLOR 215 050 085
        END
   TEMPLATE void

But again, this does not work.. This time I get this message:


Warning: [MapServer Error]: msDrawMap(): Failed to draw layer named 'comuni'. in c:\programmi\apache group\apache\htdocs\abruzzo\_test_odbc.php on line 6

Warning: [MapServer Error]: msDBFGetItemIndex(): Item 'FIELD' not found. in c:\programmi\apache group\apache\htdocs\abruzzo\_test_odbc.php on line 6

Fatal error: Call to a member function on a non-object in c:\programmi\apache group\apache\htdocs\abruzzo\_test_odbc.php on line 7

Can someone give me a hand with this?
I' ve been searching for documentation and/or examples in the net but so far I just cannot have clear ideas about how to use/what's the sintax of some of the elements of the map file..

Thanks a lot in advance.

Joao Antunes





---------------------------------
 ALL-NEW Yahoo! Messenger - all new features - even more fun!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20050209/a0d50dd0/attachment.html


More information about the mapserver-users mailing list