I understand that PostGIS allows us to set SRID on geometry or geography. But I am just wondering if it would actually impact the rendering performance on the client side.

For instance, let's say I have set 4326 as SRID on my geometry column in postgis and visualize it on Google Maps which uses EPSG3857. I assume, in this case, there need to be some sort of computation to project 4326 geometry values into 3857 geometry values. Does that mean I should have set 3857 as SRID so that there is no need for unnecessary geometry transformation?

Probably this does not really matter for small datasets but does it make any differences for bigger datasets, say 500GB?

  • 2
    Part of it depends on whether you actually project the data, or just set an incorrect SRID (the latter won't work).
    – Vince
    Oct 12, 2021 at 14:31
  • what middle ware are you using to render the tables to client side?
    – ziggy
    Oct 12, 2021 at 14:37
  • 1
    Never set an SRID if you are not 100% sure it's what you need to do - and in 90% of cases it is not what you need to do! Language shapes ones thoughts - so watch the terminology; if anything, you want to transform (or reproject) your geometry column! And if that is even necessary is indeed dependent on the client library, the tille server, and the format the data is requested in. In general, however, you assume correctly that, if the renderer uses a different CRS, a calculation has to be performed.
    – geozelot
    Oct 12, 2021 at 14:57
  • @ziggy Thank you for your comments. We use GeoServer to publish data as a web service and users consume data from WMTS so it probably does not matter but I also think having 4326 geometry in postgis could slow down the tile seeding.
    – rks
    Oct 13, 2021 at 1:05
  • @geozelot I see. So if I am sure that the clients only requests features in 3857, it is better for me to pre-transform geometry into 3857 in postgis and doing this makes differences to performance, is my understanding alright?
    – rks
    Oct 13, 2021 at 1:06


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.