Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id B6E671337BA6 for ; Wed, 1 Dec 2010 05:14:03 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 32972-08 for ; Wed, 1 Dec 2010 09:13:57 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qw0-f46.google.com (mail-qw0-f46.google.com [209.85.216.46]) by mail.postgresql.org (Postfix) with ESMTP id F008C1337BA5 for ; Wed, 1 Dec 2010 05:13:55 -0400 (AST) Received: by qwb7 with SMTP id 7so6828000qwb.19 for ; Wed, 01 Dec 2010 01:13:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=l+N+/Ey6jbBRJgrLC0sCel8SjtNf/UKGkjCtNeI4KuM=; b=JrU9iHwmlC5uELIjqF9b+RYTdUMGxphNi77SSosy6s52C2juFf7XIS22X01jrw4gRW dGax1Byzfjzr/TcAha+HigGSyd3G5CJl5VmxlVvSdFjQKMBQNhsvEKJJrPM0j9CEP+zN QNUdCO4Fw0ppMomFh9siPygKsCFPxf4MiR7oQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=Kvb/Kd7imWm5DbJt60Z8QUar9DXONlCazhofEy0wj05QW63xWwwH5MExnI4N4HVz1I f1whFwmH5fdk+88tKAn2C1d6r5CR8EPpo4rn46wClYCupgjQhgtFmP0LN7NJhBcjMQcY VBH0c22+y1X51PJPDpZSTTlhncHjrHyLUwrCg= Received: by 10.229.212.133 with SMTP id gs5mr7038806qcb.122.1291194835779; Wed, 01 Dec 2010 01:13:55 -0800 (PST) Received: from [192.168.1.100] (207-237-122-16.c3-0.wsd-ubr1.qens-wsd.ny.cable.rcn.com [207.237.122.16]) by mx.google.com with ESMTPS id m7sm4666476qck.1.2010.12.01.01.13.53 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 01 Dec 2010 01:13:54 -0800 (PST) Message-ID: <4CF611D0.9030505@gmail.com> Date: Wed, 01 Dec 2010 04:13:52 -0500 From: Lee Hachadoorian User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) Gecko/20101027 Thunderbird/3.0.10 MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: OT - load a shp file References: <201011302206.58515.johnf@jfcomputer.com> In-Reply-To: <201011302206.58515.johnf@jfcomputer.com> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.6 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7 X-Spam-Level: X-Archive-Number: 201012/4 X-Sequence-Number: 34840 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