I have a shapefile that I have imported into PostgreSQL using the PostGIS Shapefile Importer and it is currently projected in a State Plane Coordinate System. When I imported it, I selected an import SRID of 4326 (WGS84). Afterwards when I was trying to manipulate, I was getting some odd results because of the fact that my information was still seemingly in a projected coordinate system.
Does the Shapefile Importer not re-project when you assign the SRID while importing?
Answer
you can do a few things
set your srid to your state plane CS then use the st_transform function to convert to WGS84 on your geometry during whatever calculation you are performing -this will only reporject or transform the SRID on the query manipulation you are performing, it will not change the underlining SRID for the original table
st_transform(ST_SetSRID(geom,'state plane CS'),4326)
change your underlining SRID before you perform the calculations
SELECT UpdateGeometrySRID('table name','geom',4326);
ALTER TABLE 'table name'
ALTER COLUMN geom
TYPE Geometry(point/line..?, 4326)
USING ST_Transform(geom, 4326);
Update 'table name' set geom= st_transform(geom,4326);
select st_srid(geom) from 'table name';
No comments:
Post a Comment