block by jczaplew 8810346

PostGIS to MySQL

Postgres:

psql

    CREATE DATABASE federal lands; 
    \c federal lands;
    CREATE EXTENSION postgis;
    CREATE EXTENSION postgis_topology;

shell

shp2pgsql -s 4326 fedlanp020.shp | psql -h localhost -U john -d federal_lands

psql or pgAdmin SQL window

    ALTER TABLE fedlanp020 ADD COLUMN wkt TEXT;
    UPDATE fedlanp020 SET wkt = ST_AsText(geom);

    ALTER TABLE fedlanp020 DROP COLUMN feature2;
    ALTER TABLE fedlanp020 DROP COLUMN feature3;
    ALTER TABLE fedlanp020 DROP COLUMN state;
    ALTER TABLE fedlanp020 DROP COLUMN fedlanp020;
    ALTER TABLE fedlanp020 DROP COLUMN geom;

    COPY fedlanp020 TO '/path/to/where/you/want/the/file/federal_lands.csv' DELIMITER ',' CSV HEADER;

##MySQL:

  CREATE TABLE federal_lands (gid INT, feature1 VARCHAR(80), agbur VARCHAR(7), name1 VARCHAR(80), wkt TEXT);

  load data local infile '/path/to/where/you/want/the/file/federal_lands.csv' into table federal_lands fields terminated by ',' enclosed by '"' lines terminated by '\n' (gid, feature1, agbur, name1, wkt);

  ALTER TABLE federal_lands ADD geom GEOMETRY;
  UPDATE federal_lands SET geom = GeomFromText(wkt);