using OGR to connect MySQL (again)

Murat BEYHAN beyhan at DEPREM.GOV.TR
Tue Sep 12 06:35:10 EDT 2006


Dear All,

I'm still struggled with connect mysql and read information for draw points on
the map.

I'm trying to do that I suppose you can easily read information for the
latitude and longitude of the epicenter points of the earthquakes and you can
draw those points on he map by using OGR or GDAL.

I mean there is no need to make shp files for this. am I right?
for this reason to understand OGR, I have tried to execute following 

<OGRVRTDataSource>
    <OGRVRTLayer name="aqidata">
       
<SrcDataSource>MYSQL:testogr,user=root,password=mysql_123,host=localhost,port=3306,tables=testogr</SrcDataSource>

        <SrcSQL>SELECT id, lat, lon, data FROM tableogr</SrcSQL> 
        <GeometryType>wkbPoint</GeometryType>
        <GeometryField encoding="PointFromColumns" lat="lat" lon="lon"/> 
    </OGRVRTLayer>
</OGRVRTDataSource>

I have faced following
[murat at sakura ~]$ ogrinfo aqidata.ovf
ERROR 4: Update access not supported for VRT datasources.
ERROR 1: Failed to open datasource
`MYSQL:testogr,user=root,password=mysql_123,host=localhost,port=3306,tables=tableogr'.
FAILURE:
Unable to open datasource `aqidata.ovf' with the following drivers.
  -> ESRI Shapefile
  -> MapInfo File
  -> UK .NTF
  -> SDTS
  -> TIGER
  -> S57
  -> DGN
  -> VRT
  -> AVCBin
  -> REC
  -> Memory
  -> CSV
  -> GML
  -> SQLite
  -> PostgreSQL
[murat at sakura ~]$     


But I try to do followings those are work
I think this create virtual data, right?

 [murat at sakura ~]$ ogr2ogr -f "ESRI Shapefile"
MySQL:testogr,user=root,password=mysql_123
/var/www/html/mapdata/world_adm0.shp -nln tableogr1 -append -lco
GEOMETRY_NAME=SHAPE2
[murat at sakura ~]$ ogrinfo MySQL:testogr,user=root,password=mysql_123 tableogr1 -so
INFO: Open of `MySQL:testogr,user=root,password=mysql_123'
using driver `ESRI Shapefile' successful.

Layer name: tableogr1
Geometry: Polygon
Feature Count: 209
Extent: (-180.000183, -90.000000) - (180.000000, 83.623032)
Layer SRS WKT:
(unknown)
NAME: String (40.0)
GMI_CNTRY: String (3.0)
REGION: String (25.0)
How can I use OGR MYSQL MAPSERVER to do a map that the information will come
from MySQL tables.
Thank you very much for your interest...
Murat

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the mapserver-users mailing list