What is the SRID of census.gov shapefiles?
The first step to determining the correct projection of any layer, is to find the projection information, if any, that came with your layer. In the case of a Shapefile
, like what you downloaded from Census.gov, that information is contained in a .prj
file, short for Projection.
Here are the contents of the projection file from the census data:
GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
The key parts of this, are the first word GEOGCS means Geographic Coordinate System
, the string DATUM: D_North_American_1983
, SPHERIOD: GRS_1980
, and the last part UNIT: Degree
.
These easily match up to the Proj4 definition that you received: +proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs
You can see that the datum and ellipsoid, match up to the datum and spheriod in the ".prj". The longlat
means Longitude/Latitude
, which is measured in Units of Degrees
, which matches the ".prj" file.
There are "no defs" because no additional information is necessary to identify the Geographic Coordinate System.
A site to search for spatial references is: SpatialReference.org
The Geographic Coordinate System in NAD 83 is hard to come up with directly, because it is a part of many other projections.
To make it easier, the one you need is EPSG 4269.
This link presents the spatial reference information in a number of different formats. The one specifically for PostGIS is:
INSERT into spatial_ref_sys (srid, auth_name, auth_srid, proj4text, srtext) values ( 94269, 'epsg', 4269, '+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs ', 'GEOGCS["NAD83",DATUM["North_American_Datum_1983",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],AUTHORITY["EPSG","6269"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4269"]]');
To address your last point regarding the SRID = -1, I think it is important to test your data before you assume they are useless. Try to bring it up in some GIS software, like QGIS, or ArcGIS. Look at the coordinates that are shown as you move the cursor around. If you see familiar ranges of numbers, like y = 0 – +90 and x = -180 – +180, you should recognize these as Latitude/Longitude. Beginning to recognize the coordinate ranges that occur in the common projections and coordinate systems in your area will help you greatly as you move forward in your career.
If you are interested in learning more about projections and coordinate systems, this is a fantastic reference: A Working Manual (PDF) - John P. Snyder
@Get Spatial is right and it couldnt have been better answer to this question. in addition to him you can check out spatial_ref_sys before adding any spatial reference.
SELECT * FROM
spatial_ref_sys WHERE auth_srid = 4269;
probably you will take sth like this:
SRID | AUTH_NAME | AUTH_SRID | SRTEXT
------+------------+------------+-------
4269 | EPSG | 1624 | <big SRTEXT string>
SRTEXT = GEOGCS["NAD83",DATUM["North_American_Datum_1983",SPHEROID["GRS
1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],AUTHORITY["EPSG","6269"]],
PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,
AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4269"]]
PROJ4TEXT = +proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs
Spatial_ref_sys is merely a table of known coordinate systems keyed by their SRID. you cabn get more info here...
- srid: The numeric SRID. This should be the table’s primary key.
- auth_name: An authority name as a string. This is set if this coordinate system is specified by an outside authority such as EPSG.
- auth_srid: The numeric ID of the coordinate system in the above authority’s catalog.
- srtext: The Well-Known-Text (WKT) representation of the coordinate system (as we described in part 4).
- proj4text: The Proj4 representation of the coordinate system.
and last thing is that for loading it to database use this command:
shp2pgsql -c -D -s 4269 -I tl_2011_02_anrc.shp myschema.mytable > mysql.sql
psql -d mydb -f mysql.sql
i hope it helps you....