|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
geometry from postgis to mysqlI had a go posting this in the MySQL forum but with no luck...
I have a PostGIS database with various columns of geometry data. I need to import all this into a MySQL database instead (my uni won't run PostGIS on their servers) and have decided to create the tables from scratch and then just do a search and replace on the insert statements to convert from Postgre to MySQL. I have tried both INSERT INTO RoadNode VALUES ('osgb4000000029762763', 3, '2005-09-14', 'osgb1000001824287062', 'GeomFromWKB(0101000000000000008A2B204100000000B07EF940)'); and INSERT INTO RoadNode VALUES ('osgb4000000029762711', 3, '2005-09-14', 'osgb1000001824287705', '010100000000000000082C2041000000006070F940'); both of which return the error message: >[Error] Script lines: 1-1 -------------------------- Data truncation: Cannot get geometry object from data you send to the GEOMETRY field Does anyone know what I am doing wrong? Thanks, Natasha |
|
|
Re: geometry from postgis to mysqlHave you tried using pgsql2shp and then shp2mysql?
----- Original Message ----- From: tashjp <tashjp@...> Date: Sunday, November 11, 2007 4:38 pm Subject: [postgis-users] geometry from postgis to mysql > > I had a go posting this in the MySQL forum but with no luck... > I have a PostGIS database with various columns of geometry data. I > need to > import all this into a MySQL database instead (my uni won't run > PostGIS on > their servers) and have decided to create the tables from scratch > and then > just do a search and replace on the insert statements to convert from > Postgre to MySQL. > > I have tried both > > INSERT INTO RoadNode VALUES ('osgb4000000029762763', 3, '2005-09-14', > 'osgb1000001824287062', > 'GeomFromWKB(0101000000000000008A2B204100000000B07EF940)'); > > and > > INSERT INTO RoadNode VALUES ('osgb4000000029762711', 3, '2005-09-14', > 'osgb1000001824287705', > > both of which return the error message: > >[Error] Script lines: 1-1 -------------------------- > Data truncation: Cannot get geometry object from data you send to the > GEOMETRY field > > Does anyone know what I am doing wrong? > > Thanks, Natasha > -- > View this message in context: http://www.nabble.com/geometry-from- > postgis-to-mysql-tf4787330.html#a13695426 > Sent from the PostGIS - User mailing list archive at Nabble.com. > > _______________________________________________ > postgis-users mailing list > postgis-users@... > http://postgis.refractions.net/mailman/listinfo/postgis-users > postgis-users mailing list postgis-users@... http://postgis.refractions.net/mailman/listinfo/postgis-users |
|
|
Re: geometry from postgis to mysqlTry with GDAL/OGR (http://gdal.org/ogr)
This is example to convert a data ESRI Shapefile to MySQL : ogr2ogr -f MySQL MySQL:gis,user=user,password=secret shape_file.shp -lco GEOMETRY_NAME=the_geom Example to convert a PostGIS to MySQL : ogr2ogr -f MySQL MySQL:gis,user=user,password=secret PG:"host=172.27.1.245 user=user dbname=gis" "map_province_boundary_polygon" -lco GEOMETRY_NAME=the_geom -a_srs EPSG:4326 -overwrite To check your MySQL data : ogrinfo MySQL:gis,user=root,password=root district -so INFO: Open of `MySQL:gis,user=user,password=secret' using driver `MySQL' successful. Layer name: district Geometry: Polygon Feature Count: 6 Extent: (105.096718, -6.998588) - (106.774400, -5.875104) Layer SRS WKT: (unknown) FID Column = OGR_FID Geometry Column = the_geom district: String (50.0) province: String (50.0) class: String (50.0) On 11/12/07, Kyle.Wilcox@... <Kyle.Wilcox@...> wrote: Have you tried using pgsql2shp and then shp2mysql? -- Bayu Kurniawan R GIS Programmer PT. Sigma Cipta Utama Jl. Tekno I Blok B No:5,6,7 BSD City Tangerang 15314 Indonesia Phone : +62 21 75871955 ext.304 _______________________________________________ postgis-users mailing list postgis-users@... http://postgis.refractions.net/mailman/listinfo/postgis-users |
|
|
RE: geometry from postgis to mysqlThank you both for your help, I have now succeeded in converting to shp and then to MySQL using pgsql2shp and then shp2mysql.
Get free emoticon packs and customisation from Windows Live. Pimp My Live! _______________________________________________ postgis-users mailing list postgis-users@... http://postgis.refractions.net/mailman/listinfo/postgis-users |
|
|
Re: geometry from postgis to mysqltashjp - tashjp@... a écrit :
> I had a go posting this in the MySQL forum but with no luck... > INSERT INTO RoadNode VALUES ('osgb4000000029762763', 3, '2005-09-14', > 'osgb1000001824287062', > 'GeomFromWKB(0101000000000000008A2B204100000000B07EF940)'); Wouldn't it be : INSERT INTO RoadNode VALUES ('osgb4000000029762763', 3, '2005-09-14', 'osgb1000001824287062', GeomFromWKB(0101000000000000008A2B204100000000B07EF940)); i.e. without quotes around the GeomFrilWKB ? Regards -- Arnaud _______________________________________________ postgis-users mailing list postgis-users@... http://postgis.refractions.net/mailman/listinfo/postgis-users |
| Free embeddable forum powered by Nabble | Forum Help |