[GIS] Postgis geometry column with different srid

coordinate systemopenlayers-2postgissrid

I have a table that has geometry column named the_geom. I set SRID value to 29903. And I used Openlayers api to view data on map. I set map srid as 29903 and works well.

But if I need to show my data on google map or another map api that SRID is 4326 or else, should I change my database geometry column SRID.

How can I use multiple SRID for a geometry?

Best Answer

If you don't define SRID for the geometry column at the time of its creation, you can insert geometries with any SRID. I can't think of a reason you would want to do that though. It's reasonable to store all geometries with the same SRID.

I see three options you have:

  • create new geometry column and fill it with st_transform(geom1, new_srid)
  • use `st_transform(geom1, new_srid) on-the-fly
  • use WMS as @iant mentioned

It depends on your use case, how big data is etc.

Related Question