[Chugalug] crazy

Ed King chevyiinova at bellsouth.net
Mon Nov 18 13:58:00 UTC 2013


install postgis and look at the readme file in the extras/tiger folder, and all will become clear. :)

postgis generates a bash script that will download the census data and squirt it into the postgis-enabled postgres database...     


here's a sample...

set -e -u
TMPDIR="/sdb1/gisdata/temp/"
UNZIPTOOL=unzip
WGETTOOL="/usr/bin/wget"
export PGBIN=/usr/local/pgsql/bin/
export PGPORT=5432
export PGHOST=localhost
export PGUSER=postgres
export PGPASSWORD=ed_is_god (not my real password)
export PGDATABASE=geo
PSQL=${PGBIN}/psql
SHP2PGSQL=${PGBIN}/shp2pgsql
cd /sdb1/gisdata

cd /sdb1/gisdata
wget ftp://ftp2.census.gov/geo/tiger/TIGER2013/STATE/ --no-parent --relative --recursive --level=1 --accept=zip --mirror --reject=html
cd /sdb1/gisdata/ftp2.census.gov/geo/tiger/TIGER2013/STATE
rm -f ${TMPDIR}/*.*
${PSQL} -c "DROP SCHEMA IF EXISTS tiger_staging CASCADE;"
${PSQL} -c "CREATE SCHEMA tiger_staging;"
for z in tl_*state.zip ; do $UNZIPTOOL -o -d $TMPDIR $z; done
# for z in */tl_*state.zip ; do $UNZIPTOOL -o -d $TMPDIR $z; done
cd $TMPDIR;

${PSQL} -c "CREATE TABLE tiger_data.state_all(CONSTRAINT pk_state_all PRIMARY KEY (statefp),CONSTRAINT uidx_state_all_stusps  UNIQUE (stusps), CONSTRAINT uidx_state_all_gid UNIQUE (gid) $
${SHP2PGSQL} -c -s 4269 -g the_geom   -W "latin1" tl_2013_us_state.dbf tiger_staging.state | ${PSQL}
${PSQL} -c "SELECT loader_load_staged_data(lower('state'), lower('state_all')); "
        ${PSQL} -c "CREATE INDEX tiger_data_state_all_the_geom_gist ON tiger_data.state_all USING gist(the_geom);"
        ${PSQL} -c "VACUUM ANALYZE tiger_data.state_all"




________________________________
 From: K I Goldman <kigtest at hotmail.com>
To: Chattanooga Unix Gnu Android Linux Users Group <chugalug at chugalug.org> 
Sent: Monday, November 18, 2013 8:10 AM
Subject: Re: [Chugalug] crazy
 


From where are you downloading the census data?

The protein database is also fun to play with. 

Keith

On Nov 16, 2013, at 12:59 PM, "Ed King" <chevyiinova at bellsouth.net> wrote:


slackware fanboy, so I usually download source and compile and install.     I'm crazy like that.
>
>
>so anyway I'm currently attempting to install postgis and the census tiger data to set up my own local geocode database because geocoder.us is getting flakey lately
>
>
>
>part of the dependancies was this... http://gdal.org/
>I don't claim to understand what it does, but I's need it
>
>
>anyway, the whole point of this worthless email is that I was amazed at how long it took to compile the source code for gdal on an amd64 quad 3ghz with 8gb ram
>
>
>I might re-compile it again, this time put a timer on it...    cause I'm crazy like that
>
>
>and then get back to my Drupal tutorial ;-)
>
_______________________________________________
>Chugalug mailing list
>Chugalug at chugalug.org
>http://chugalug.org/cgi-bin/mailman/listinfo/chugalug
>
_______________________________________________
Chugalug mailing list
Chugalug at chugalug.org
http://chugalug.org/cgi-bin/mailman/listinfo/chugalug

_______________________________________________
Chugalug mailing list
Chugalug at chugalug.org
http://chugalug.org/cgi-bin/mailman/listinfo/chugalug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://chugalug.org/pipermail/chugalug/attachments/20131118/9527626e/attachment-0001.html>


More information about the Chugalug mailing list