OGR connection for LINUX
Frank Warmerdam
fwarmerdam at GMAIL.COM
Thu May 5 07:13:36 PDT 2005
On 5/5/05, joÿffffffffffe3o Antunes <bluetuna_goes_skying at yahoo.co.uk> wrote:
> Thank you Frank for your kind help.
>
> I still have some issues though..
>
> I don't understand which syntax I should use.. I am trying something like
>
>
> CONNECTIONTYPE OGR
> CONNECTION "C:\Programmi\Apache
> Group\Apache\htdocs\abruzzo\maps\data\comuni_abruzzo_gb.shp"
> DATA "SELECT * FROM comuni_abruzzo_gb LEFT JOIN
> 'MYGIS:database=zzzz_abruzzo, tablename=zzz, user=rt, password=rt,
> port=3306' ON comuni_abruzzo_gb.Id = zzz.ID"
Joao,
Yikes, I completely missed the join in your select. First, is your
OGR built with MySQL support? This isn't all that common.
Second, the direct MySQL support is done using:
MYSQL:database=zzzz_abruzzo,tablename=zzz,user=rt,password=rt,port=3306
(not MYGIS). Also, I suggest removing the space. Phase 1 of constructing
such a query would be to try accessing the MySQL database externally
with the ogrinfo commandline program.
eg.
ogrinfo -ro -al -so
'MYSQL:database=zzzz_abruzzo,tablename=zzz,user=rt,password=rt,port=3306'
If you don't get a list of tables doing this, then you are likely lacking the
driver. You can check for the driver using "ogrinfo --formats".
Next, try your full query with ogrinfo and see if it works.
eg.
ogrinfo -ro "C:\Programmi\Apache\Group\Apache\htdocs\abruzzo\maps\data\comuni_abruzzo_gb.shp"
-sql "SELECT * FROM comuni_abruzzo_gb LEFT JOIN
MYSQL:database=zzzz_abruzzo, tablename=zzz, user=rt, password=rt,
port=3306' ON comuni_abruzzo_gb.Id = zzz.ID"
If that works, then transfer the query back into your map.
PS. I just read the driver help for the MySQL OGR driver, and I see it said to
prefix the datasource name with MYGIS (instead of MYSQL). Sorry about that,
it was an error. I have corrected it now.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the MapServer-users
mailing list