[postgis-users] importing excel spreadsheet
fork
forkandwait at gmail.com
Tue Jul 24 14:35:32 PDT 2012
Kauth, Matthew <mkauth <at> eb.com> writes:
> Hi all. I’m working on a project with my job and have created an excel
> spreadsheet consisting of over 1000 polygon coordinates.
> Per postgres I have
> the coordinates in the following fashion
> long,lat;long,lat;long,lat, and so on.
What do you mean "per postgres"? This format isn't a standard that I know of. A
link would be interesting.
> My question, if someone can help, is how do I import this
> spreadsheet into
> postgres 9.1?
In outline, in case you have never done this before:
* Save the spreadsheet as tab-delimited text (Excel == yuck).
* Process this file to change the coordinates into "well known text" format (I
would script the conversion with awk) and save as a new file. Script little
clean ups here as well.
* Open the new text file in a real text editor to inspect and clean.
* Load this new file into Postgres with the COPY statement.
* Then convert the WKT column to a geometry column with ST_GeomFromEWKT().
WKT example:
http://postgis.refractions.net/documentation/manual-svn/using_postgis_dbmanagement.html#OpenGISWKBWKT
If you get stuck, try to give us an example of your data (cut and paste or use
pastebin) and what steps exactly you are doing. If the above doesn't make any
sense or is too high level, ask more specific questions about each step. Note
that I am assuming you have access to a functional Unix-like command line. If
not ... get a real computer ;) ...
More information about the postgis-users
mailing list