2

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?

6
  • Just use ST_Transform on the server or use proj4js or similar on the client, unless you always want you data in 4326 and will never use 29903 again. Commented Jul 10, 2015 at 9:04
  • put the postgis table into GeoServer and it will handle the reprojections for you
    – Ian Turton
    Commented Jul 10, 2015 at 9:50
  • @iant. Not everyone wants to use Geoserver, as hard as that may be to believe :-) Commented Jul 10, 2015 at 10:50
  • @JohnBarça - seems a shame to keep reinventing the wheel though
    – Ian Turton
    Commented Jul 10, 2015 at 12:23
  • @iant won't PostGIS handle the reprojections? Commented Sep 8, 2016 at 16:34

1 Answer 1

3

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.

2
  • if I am getting data from many coordinate reference systems, isn't it easier to insert them in with the CRS they come with and have PostGIS sort it out? Commented Sep 8, 2016 at 16:33
  • @DavidLeBauer It depends on what you are doing with the data. If you have numerous records with different CRS, then every time you query data from the database into a map it will have to transform each feature on the fly. It is often better to do all this processing one time, up front. This up front transformation could be easily done in PostGIS, as you suggest. Commented Sep 9, 2016 at 1:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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