0

I am new to PostGIS. I'm making a spatial join, but it does not work. From what I saw it is something of the geometry of polygons. My polygons are saved with the "Geom" field like this (Geom geometry (Multipolygon) and I need to transform them to the format (Geom geometry (Multipolygon, 4326). How can it be done?

closed as off-topic by PolyGeo Jul 2 at 21:56

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

4

Two options:

  • If your geometries are defined in EPSG:4326, you can simply assign the SRID to the column:

    SELECT UpdateGeometrySRID([<schema>,] <table>, <column>, <SRID>);
    

    as a shorthand for

    ALTER TABLE [<schema>.]<table>
      ALTER COLUMN <column> TYPE GEOMETRY(<GEOM_TYPE>, 4326)
        USING ST_SetSRID(<column>, 4326)
    ;
    
  • If they are defined in a different SRID, you need to transform them:

    ALTER TABLE [<schema>.]<table>
      ALTER COLUMN <column> TYPE GEOMETRY(<GEOM_TYPE>, 4326)
        USING ST_Transform(ST_SetSRID(<column>, <SRID>), 4326)
    ;
    

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