shp2pgsql and .prj files

Shapefiles have a .prj file which is a text description of the projection used in the shape. For some reason shp2pgsql ignores this and inserts things with the SRID 0 unless you explicitly set one with a -s flag. Maybe it’s because it’s hard to reverse the text description in the .prj and turn it into a simple SRID that PostGIS already knows about?

Update: yeah, it is hard to do the mapping of .prj -> EPSG. The .prj may even describe some weird projection not in EPSG. But for many cases it should work. The website prj2epsg.org does a best effort match.

Anyway, trying to add Mike’s metro extracts coastline to my SFO Bravo airspace database, for another lasercut with a map superimposed. Sort of have it working, but need to clean it up to remove the annoying vertical and horizontal lines: shp2pgsql -s 900913 sf-bay-area.shp | psql faa