Tuesday, 23 February 2016

qgis - PostGIS Shapefile Importer Projection SRID


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





  1. 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)


  2. 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

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...