Close

2022-09-29

What Is The SRID?

What Is The SRID?

SRID stands for Spatial Reference Identifier, a unique identifier assigned to a spatial reference system used in Geographic Information Systems (GIS). SRIDs define the coordinate system, projection, and geographic location of the data being used in a GIS system.

SRIDs are used in maps like Google Maps and Yandex Maps to define the location of data on the map, such as coordinates and address locations. The SRID converts the data into a format that can be displayed on the map, ensuring that it is accurate and up-to-date.

Here’s an example of how to use SRID in a MySQL database:

CREATE TABLE places (
id INT PRIMARY KEY,
name VARCHAR(100),
location POINT,
SRID INT
);
INSERT INTO places (id, name, location, SRID)
VALUES (1, 'Place A', ST_GeomFromText('POINT(1 1)', 4326), 4326);
view raw SRIDSQL1 hosted with ❤ by GitHub

In the example above, the SRID field is used to specify the SRID (4326) of the location field, which is stored as a POINT object in the ST_GeomFromText function.

Here’s an example of how to use SRID in Python with the GEOS library:

from django.contrib.gis.geos import Point
point = Point(1, 1, srid=4326)
point.transform(3857)
view raw SRIDSAMPLE.PY hosted with ❤ by GitHub

In the example above, the SRID (4326) is specified when creating the Point object, and the transform function is used to convert the SRID to another SRID (3857) for display on a map.

It is important to note that SRIDs are critical for ensuring the accuracy and integrity of data used in GIS systems, as they define the geographic location and projection of the data.