Changes between Version 241 and Version 242 of UserGuidelines/GIS/Data


Ignore:
Timestamp:
10/25/17 10:32:04 (7 years ago)
Author:
Fran Boon
Comment:

Import from CSV

Legend:

Unmodified
Added
Removed
Modified
  • UserGuidelines/GIS/Data

    v241 v242  
    203203
    204204 * http://docs.geoserver.org/stable/en/user/gettingstarted/web-admin-quickstart/index.html
     205
     206==== Import CSV ====
     2071. Prepare CSV (no extraneous columns, must be labelled same as schema, WKT data in a column)
     2082. Create the Schema in PostGIS:
     209{{{
     210CREATE TABLE my_table
     211(
     212  gid serial NOT NULL,
     213  name character varying(50),
     214  the_geom geometry,
     215  CONSTRAINT my_table_pkey PRIMARY KEY (gid),
     216  CONSTRAINT enforce_dims_the_geom CHECK (st_ndims(the_geom) = 2)
     217);
     218
     219CREATE INDEX my_table_the_geom_gist
     220  ON my_table
     221  USING gist
     222  (the_geom );
     223}}}
     2242. Import the CSV
     225{{{
     226psql
     227\c gis
     228\copy my_table(name,the_geom) FROM 'my_csv.csv' DELIMITERS ',' CSV HEADER;
     229}}}
     230
     231* Help was taken from: http://www.kevfoo.com/2012/01/Importing-CSV-to-PostGIS/
    205232
    206233==== Import GeoJSON ====