MySQL Forums
Forum List  »  PostgreSQL

Re: Migrating geometry data
Posted by: Ludwig Brinckmann
Date: January 13, 2008 10:20AM

A highly portable way of migrating geo data from PostGIS to MySQL (and the other way round) is to go via an intermediate shapefile. Both PostGIS and MySQL have conversion routines to support this, meaning you do not have to rely on third party tools.

To convert from PostGIS to shape file, use

pgsql2shp -g geometry_column -f shapefile DB table

Then turn it into MySQL SQL:

shp2mysql -s SRID -c shapefile table DB > mysql.sql

and ingest the data:

mysql -D DB < mysql.sql

The last two steps can of course be done in one go, but the intermediate SQL file gives a better ability to check for sanity.

HTH

Ludwig

Options: ReplyQuote


Subject
Views
Written By
Posted
12558
n p
November 07, 2007 04:29PM
7153
November 08, 2007 02:42AM
7275
n p
November 08, 2007 07:33AM
6802
November 09, 2007 01:18AM
Re: Migrating geometry data
10416
January 13, 2008 10:20AM
7096
February 03, 2008 06:13AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.