pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Lee Hachadoorian <lee.hachadoorian@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: OT - load a shp file
Date: Wed, 01 Dec 2010 04:13:52 -0500
Message-ID: <4CF611D0.9030505@gmail.com> (raw)
In-Reply-To: <201011302206.58515.johnf@jfcomputer.com>
References: <201011302206.58515.johnf@jfcomputer.com>

John,

Would probably be useful to see the results of the command, but a couple
of things are immediately obvious.

First, Postgres requires identifiers to start with a letter or
underscore. You are attempting to create a table named 2008_us_county,
which is not a legal identifier. Also, unless you want this in the
public schema, make sure to use the schema-qualified table name.

Second, the docs specify that the shapefile be passed in without the
.shp extension.

Third, since you're not specifying the database explicitly, make sure
that the default makes sense (psql assumes a default of your user name
or reads it from the PGDATABASE environment variable). The examples in
the shp2pgsql docs all explicitly specify a target database with, e.g.
… | psql -d my_db

If you fix all of this and it still isn't working, I would direct the
output to a file, look at it to make sure it makes sense, then try to
pass the file to psql.

If you would prefer, there are also a couple of GUIs that can control
shp2pgsql. I've had success with the SPIT (Shapefile to PostGIS Import
Tool) plugin for Quantum GIS (http://qgis.org/). For Windows only you
can use the Shp2PgSQL Graphical Loader (a plugin for pgAdmin III)
available at http://postgis.refractions.net/download/windows/.

Finally, a better list for PostGIS support is
postgis-users@postgis.refractions.net.

--Lee

On 12/01/2010 01:06 AM, John Fabiani wrote:
> Hi,
> How do I load a Census shp file into an exist database?  I believe I have 
> postGIS install and now I want to load the US counties shp file.  
>
> the following does not appear to work
> shp2pgsql -s 4269 -I -W latin1 tl_2008_us_county.shp 2008_us_county | psql
>
> Plus I don't know what it does!
>
> Johnf
>
>   

-- 
Lee Hachadoorian
PhD Student, Geography
Program in Earth & Environmental Sciences
CUNY Graduate Center




view thread (3+ messages)  latest in thread

Message-ID: <4CF611D0.9030505@gmail.com>
Permalink:  ../4CF611D0.9030505@gmail.com/
Also on:    postgresql.org/message-id/4CF611D0.9030505@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: lee.hachadoorian@gmail.com
  Subject: Re: OT - load a shp file
  In-Reply-To: <4CF611D0.9030505@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox