SQL Spatial Data Types:
Two kinds of spatial data types:
- geometry: flat 2D surface with two dimensions. Supposed X = 3 and Y = 4, then our point representation will be like POINT (3 4).
- geography: uses the same methods but the data type reflects the fact the we live on a curved 2D surface.
However, the two kinds of spatial data types is the need for the aforementioned Spatial Reference IDs (SRID).
Both geometry and geography data types have two parts, the coordinates of the object and the SRID number
To check the list of SRID in SQL server, we can execute query statement as belows:
The SRID number is set by EPSG standard. It dictates that the SRID of any geometry data is 0 and for Geography the default of SRID is 4326.
Here is a link of my Github of stored procedure, which aims to get the nearest suburb for each public transport stop:
In this stored procedure, it can be seen that
Which is an application of transformation of the two spatial data types.