MySql Spatial Database

Frank Warmerdam warmerdam at POBOX.COM
Wed Oct 4 07:49:10 PDT 2006


Murat BEYHAN wrote:
> Dear Bart,
> thank you for your advice.
> I have tried the followings
> 
> ogr2ogr -f MySQL MySQL:testogr,user=root,password=passmysql cities.shb -nln
> iller -update -overwrite -lco GEOMETRY_NAME=SHAPE2
> 
> 
> This is creates 3 tables in mysql tables in testogr database.
> the names of the tables are 
> geometry_columns, 
> cities, 
> spatial_ref_sys
> 
> then I have doubt I have cities shape files the tail of the files are
> shp shx sbn sbx these are esri files.  I don't know Which one should be use
> for this?

Murat,

In the above commandline you show cities.shb as the input.  This should
be cities.shp, perhaps this was just a typo if things worked?  Generally
speaking OGR depends on the .shp, .shx and .dbf file.  The .sbn and .sbx
spatial indexes are ignored.

> And How can I connect and read data by using ogr connection from map file.

You would use:

CONNECTIONTYPE OGR
CONNECTION "MySQL:testogr,user=root,password=passmysql"
DATA "cities"

for your layer.

> I have an experiment if the data stored regularly as lat and lon in the table
> I can read those for draw point. But My problem if I have polygone or line
> data in mySql How can I read those data to create a layer on my map file by
> using OGR. So I'm trying to use spatial database.

Note that a true spatial table in MySQL is handled very differently from
a table with lat and lon columns which is usually handled via ODBC and
OVF.

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    | President OSGeo, http://osgeo.org



More information about the MapServer-users mailing list