Chapter 4. Standards Implementation

1. Spatial Standards
1.1. OGC
1.2. ISO
1.3. JASPA implementation
2. Standards Disparity
2.1. Default SRID
2.2. Boolean

1. Spatial Standards

There are two organizations producing spatial standards of particular importance, the ISO (International Organization for Standardization) and OGC (Open GIS Consortium).

1.1. OGC

OGC provides a wide range of Standards and Specifications. The OGC Simple Features Interface Standard (SFS) is specially important. It provides a well-defined and common way for applications to store and access feature data in relational or object-relational databases. There are three versions of this Standard, though the first two ones are deprecated.

Table 4.1. OGC SFS Standards

VersionDocument TitleDocument
1.1OpenGIS Simple Features Implementation Specification for SQL99-049
1.1.0OpenGIS Implementation Specification for Geographic information - Simple feature access05-134
1.2.0OpenGIS Implementation Specification for Geographic information - Simple feature access - Part 2: SQL option06-104r3

The 1.2.0 specification, appeared in 2006, develops the previous specifications to support "Z" and "M" (measure) coordinates.

OGC Specifications can be found in:

1.2. ISO

The ISO/IEC 13249 SQL Multi-Media and Application Packages standard is specially important. This standard, known as SQL/MM, is divided in the following parts:

  1. Part 1: Framework

  2. Part 2: Full-Text

  3. Part 3: Spatial

  4. Part 5: Still Image

  5. Part 6: Data Mining

SQL/MM- Part 3 standardizes spatial types and routines to store, manage and retrieve spatial data using SQL.

1.3. JASPA implementation

In the chapter JASPA Reference, a definition of each function can be found. It includes the section of the spatial standards that are implemented. For instance, the method ST_Area implements the following standard methods:

Table 4.2. Spatial Standards Support

OGC SFS for SQL. 1.1 (1999)OGC SFS for SQL. 1.1.0 (2005)OGC SFS for SQL. 1.2.0 (2006)SQL-MM Part 3
2.1.9.17.2.14.17.2.12.28.1.2 - 9.5.3

2. Standards Disparity

There are several differences between the spatial specifications and the implementation in JASPA.

2.1. Default SRID

Each spatial feature has a spatial reference identifier (SRID). The default SRID for geometry instances in the SQL-MM standard is 0, whereas in JASPA the default value is -1.

In the following example JASPA sets the ST_GeomCollection SRID to -1, instead of 0 (zero) as stated in SQL-MM. It it done to keep PostGIS compatibility.

SELECT ST_SRID(ST_GeomCollFromText('GEOMETRYCOLLECTION(POINT (5 5))'));

 st_srid
---------
      -1
(1 row)

2.2. Boolean

The return type of boolean methods (e.g. ST_IsValid, ST_IsClosed, ST_Crosses ...) in JASPA differs from the spatial specifications.

SQL/MM

Returns 1 if TRUE, 0 if FALSE or NULL

JASPA for PostgreSQL

Returns "t" if TRUE, "f" if FALSE, null if the Geometry is NULL.

JASPA for H2

Returns "TRUE" if TRUE, "FALSE" if FALSE, null if the Geometry is NULL.

(1) SELECT ST_IsValid(ST_GeomFromText('POINT (0 0 )'));

--JASPA for PostgreSQL
 st_isvalid
------------
 t
(1 row)

--JASPA for H2
TRUE

(2) SELECT ST_IsClosed(ST_GeomFromText('POINT EMPTY'));

--JASPA for PostgreSQL
 st_isclosed
-------------

(1 row)

--JASPA for H2
null