[mapserver-users] MySQL connection: so near, yet so far...

Chris Green chris.green at ibstv.co.uk
Wed Jun 22 10:16:54 EDT 2011

Thanks Stephen

That was a useful pointer, I have the OGR connection working now. One
remaining problem: the source data in my MySQL database is unprojected
lat/lon, and I want to project to Google 900913. 

It seems that it should be possible to get OGR to do this within the ovf
file by including an SRS statement like <LayerSRS>EPSG:900913</LayerSRS>,
but this doesn't work. Adding a projection statement to the layer doesn't
help either.

Anyone know how to do this?


-----Original Message-----
From: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Stephan Holl
Sent: 22 June 2011 12:56
To: mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] MySQL connection: so near, yet so far...

Hello Chris,

"Chris Green" <chris.green at ibstv.co.uk>, [20110622 - 12:17:35]

> I am trying to establish a MySQL connection to a Mapserver 6.0 layer 
> using OGR. After much trial and error (mostly error) I have got to the 
> point where I have an ovf file which I can test using ogrinfo, but 
> which I cannot make work in a layer.
> My ovf file (OGR_test.ovf) is
> <OGRVRTDataSource>
>     <OGRVRTLayer name="OGR_test">
> <SrcDataSource>mysql:testDB,user=root,password=mysql,port=3306,tables=
> testTa
> ble</SrcDataSource>
>         <SrcSQL>SELECT City, Latitude, Longitude FROM 
> testTable</SrcSQL> <GeometryType>wkbPoint</GeometryType>
>         <GeometryField encoding="PointFromColumns" x="Longitude"
> y="Latitude"/>
>     </OGRVRTLayer>
> </OGRVRTDataSource>
> I can successfully test this and see the data in testTable via:
> ~# ogrinfo var/www/vhosts/mysite/httpdocs/data/OGR_test.ovf
> However when I create a test layer I cannot establish the OGR 
> connection. I am trying with:
>   NAME "testLayer"
>   CONNECTION "OGR_test.ovf"
>   DATA "OGR_test"
>     NAME "MyClass"
>     STYLE
>       SYMBOL 'circle'
>       SIZE 15
>       COLOR 0 255 0
>     END
>   END
> This produces an "internal server error".
> I have also tried using an absolute path to OGR_test.ovf, still no 
> success. It seems that I have not got the CONNECTION and DATA 
> parameters right but after reading the MySQL and the OGR sections in 
> the Mapserver documentation many times I still can't figure out what 
> I'm doing wrong.
> Can someone help?

Just a guess.

Make sure you have the exact same env-vars set for apache as you have set
within the shell your ogrinfo-command works. Sometimes there can be a
differnces there?



Stephan Holl <stephan.holl at intevation.de> | Tel.: +49 (0)541-33 508 3663
Intevation GmbH, Neuer Graben 17, 49074 OS  |  AG Osnabrück - HR B 18998
Geschäftsführer:  Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner

More information about the mapserver-users mailing list