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?

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.