Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » SQL Anywhere Server - Spatial Data Support » Spatial data

Spatial reference systems (SRS) and Spatial reference identifiers (SRID)

In the context of spatial databases, the defined space in which geometries are described is called a spatial reference system (SRS).

A spatial reference system defines, at minimum:

  • Units of measure of the underlying coordinate system (degrees, meters, and so on)

  • Maximum and minimum coordinates (also referred to as the bounds)

  • Default linear unit of measure

  • Whether the data is planar or spheroid data

  • Projection information for transforming the data to other SRSs

Every spatial reference system has an identifier called a Spatial Reference Identifier (SRID). When the database server performs operations like finding out if a geometry touches another geometry, it uses the SRID to look up the spatial reference system definition so that it can perform the calculations properly for that spatial reference system. Each SRID must be unique in a database.

By default, the database server adds the following spatial reference systems to a new database:

  • Default - SRID 0

    This is the default spatial reference system used when constructing a geometry and the SRID is not specified in the SQL and is not present in the value being loaded.

    Default is a Cartesian spatial reference system that works with data on a flat, two dimensional plane. Any point on the plane can be defined using a single pair of x, y coordinates where x and y have the bounds -1,000,000 to 1,000,000. Distances are measured using perpendicular coordinate axis. This spatial reference system is assigned SRID of 0.


    Image of an X Y grid showing points at -1 2, and 2 2.

    Cartesian is a planar type of spatial reference system.

  • WGS 84 (planar) - SRID 1000004326

    WGS 84 (planar) is similar to WGS 84 except that it uses equirectangular projection, which distorts length, area and other computations. For example, at the equator in both SRID 4326 and 1000004326, 1 degree longitude is approximately 111 km. At 80 degrees north, 1 degree of longitude is approximately 19 km in SRID 4326, but SRID 1000004326 treats 1 degree of longitude as approximately 111 km at all latitudes. The amount of distortion of lengths in the SRID 1000004326 is considerable (off by a factor of 10 or more), and the distortion factor varies depending on the location of the geometries relative to the equator. Consequently, SRID 1000004326 should not be used for distance and area calculations. It should only be used for relationship predicates such as ST_Contains, ST_Touches, ST_Covers, and so on.

    The default unit of measure for WGS 84 (planar) is DEGREE, and it is a flat-Earth type of spatial reference system.

  • WGS 84 - SRID 4326

    The WGS 84 standard provides a spheroidal reference surface for the Earth. It is the spatial reference system used by the Global Positioning System (GPS). The coordinate origin of WGS 84 is the Earth's center, and is considered accurate up to ±1 meter. WGS stands for World Geodetic System.

    WGS 84 Coordinates are in degrees, where the first coordinate is longitude with bounds -180 to 180, and the second coordinate is latitude with bounds -90 to 90.

    The default unit of measure for WGS 84 is METRE, and it is a round-Earth type of spatial reference system.

  • sa_planar_unbounded - SRID 2,147,483,646

    For internal use only.

  • sa_octahedral_gnomonic - SRID 2,147,483,647

    For internal use only.

Installing additional spatial reference systems using the sa_install_feature system procedure

The software also provides thousands of predefined SRSs for use. However, these SRSs are not installed in the database by default when you create a new database. You use the sa_install_feature system procedure to add them.

You can find descriptions of these additional spatial reference systems at SpatialReference.orgInformation published on non-SAP site and EPSG Geodetic Parameter RegistryInformation published on non-SAP site.

Determining the list of spatial reference systems currently in the database

Since you can define a spatial reference system however you want and can assign any SRID number, the spatial reference system definition (projection, coordinate system, and so on) must accompany the data as it moves between databases or is converted to other SRSs. For example, when you unload spatial data to WKT, the definition for the spatial reference system is included at the beginning of the file.

Spatial reference system information is stored in the ISYSSPATIALREFERENCESYSTEM system table. The SRIDs for the SRSs are used as primary key values in this table. The database server uses SRID values to look up the configuration information for a spatial reference system so that it can interpret the otherwise abstract spatial coordinates as real positions on the Earth.

You can find the list of spatial reference systems by querying the ST_SPATIAL_REFERENCE_SYSTEMS consolidated view. Each row in this view defines a spatial reference system.

You can also look in the Spatial Reference Systems folder in SQL Central to see the list of spatial reference systems installed in the database.

Compatibility with popular mapping applications

Some popular web mapping and visualization applications such as Google Earth, Bing Maps, and ArcGIS Online, use a spatial reference system with a Mercator projection that is based on a spherical model of the Earth. This spherical model ignores the flattening at the Earth's poles and can lead to errors of up to 800m in position and up to 0.7 percent in scale, but it also allows applications to perform projections more efficiently.

In the past, commercial applications assigned SRID 900913 to this spatial reference system. However, EPSG has since released this projection as SRID 3857. For compatibility with applications requiring 900913, you can do the following:

  1. Use the sa_install_feature system procedure to install all of the provided spatial reference systems (including SRID 3857).

  2. Unload the database to get the 3857 SRID definition.

  3. Create a spatial reference system with SRID 900913 using the information from the unloaded SRID definition.