spatial – Understanding the Role of SRID in Geometry Types

geometryspatialsrid

From my understanding, SRID is a projection code; how the 2d coordinate system is fit over a spheroid.

The difference between Geometry and Geography types, from my understanding, is that a geometry type is two dimensional, and a geography type is 3 or four dimensional.Therefore what's the point of an SRID in a geometry type?

Best Answer

You are correct in your interpretation of a SRID. It identifies the projection used to locate the Geometry or Geography. Even if the database in question (I'm assuming SQL Server) doesn't make use of the SRID directly, the point of it is to identify how to work with the coordinates in relationship to others. I suppose you could look at it like having a country code on a phone number. Not always necessary, but important none the less.

Your understanding of Geometry vs Geography isn't correct.
Geometry is used to store objects which are projected to a Cartesian or Planar coordinate system. They are not restricted to just 2 dimensions. They use distance units to (metres, feet, etc) to represent points.
Geography is used to store objects that are projected on a Spherical coordinate system. These systems use degrees (Latitudes and Longitudes) to represent points.

It is important to use the correct data type for your information. If your objects have Latitude and Longitude coordinates, store them in a Geography. This means when you use distance and area functions you will get a sensible result.

While some systems (SQL Server) mostly ignore the SRID in geometries, it is still important metadata and should be set correctly. Other databases and software can and do use the SRID to determine how to treat the coordinates in the object, allowing for the coordinates to be reprojected to other coordinate systems and compared correctly to other objects that are projected differently.