2

I'm having trouble combining shapefiles from TIGER and different local governments into a single postgis db to query legislative locations. I've imported all data to multipolygon geom, but found some datasets' polygon shapes returning really large floats values lat/lng. Looking more closely, I noticed inconsistent EPSG coordinate systems, based on searching prj2epsg.org with contents of my .prj files:

#Census Data (EPSG:4269 - GCS_North_American_1983)    
GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]

#Texas Data (EPSG:3081 - NAD_1983_Lambert_Conformal_Conic)
PROJCS["NAD_1983_Lambert_Conformal_Conic",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",1000000.0],PARAMETER["False_Northing",1000000.0],PARAMETER["Central_Meridian",-100.0],PARAMETER["Standard_Parallel_1",34.91666666666666],PARAMETER["Standard_Parallel_2",27.41666666666667],PARAMETER["Latitude_Of_Origin",31.16666666666667],UNIT["Meter",1.0]]

I can't seem to get ogr2ogr to explicitly transform the target coordinate systems with -a_srs EPSG:3081 -s_srs EPSG:3081 -t_srs EPSG:4269:

ogr2ogr -f PostgreSQL PG:"host=..." file.shp -nlt MULTIPOLYGON -s_srs EPSG:3081 -a_srs EPSG:3081 -s_srs EPSG:3081 -t_srs EPSG:4269 -lco GEOMETRY_NAME=the_geom -nln table_name.

I've tried a number of different variations on the above, but at best I get ERROR 1: AddGeometryColumn failed for layer table_name, layer creation has failed.

What am I missing here?

I'm still a bit of a novice on work with shapefiles.

Example source files:

1
  • Welcome to GIS.SE. Can you confirm some things: you have source data from two spatial reference systems (SRSs): EPSG:4269 & EPSG:3081, and your desired SRS (in PostGIS) is EPSG:4269?
    – Martin F
    Apr 15, 2014 at 4:46

1 Answer 1

3

It seems you're overcomplicating the use of SRS flags.

If you have source data from two spatial reference systems (SRSs): EPSG:4269 (Census data) and EPSG:3081 (Texas data), and your desired SRS (in PostGIS) is EPSG:4269 (same as Census data), then you'd use two variations of the ogr2ogr command.

For the Texas data, specify source and target SRSs, so data are reprojected:

ogr2ogr -f PostgreSQL PG:"...." texas.shp -nlt MULTIPOLYGON -s_srs EPSG:3081 -t_srs EPSG:4269 -lco GEOMETRY_NAME=the_geom -nln tex_table_name

For Census data, just assign it (in case it's not already assigned), without projection:

ogr2ogr -f PostgreSQL PG:"host=..." census.shp -nlt MULTIPOLYGON -a_srs EPSG:4269 -lco GEOMETRY_NAME=the_geom -nln cen_table_name
1
  • In the end the issue wound up being that I had an older version of postgis and my spatial_refs were out of date. Apr 30, 2014 at 4:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.