2. Non-
Geometry Instantiable
Instantiable
Geometry-
Point Curve Surface
Collection
1+ 2+
Multi-
LineString Polygon MultiCurve MultiPoint
Surface
1+
1+
Multi- Multi-
Line LinearRing
1+ Polygon LineString
OpenGIS Simple Features Specification for SQL
Geometry Class Hierarchy
3. Point MultiPoint LineString LinearRing
Multi- Multi- Geometry-
Polygon
LineString Polygon Collection
OpenGIS Simple Features Specification for SQL
Spatial Data Model
4. SFS Methods : Basic
● GeometryType()
– “POINT”, “POLYGON”, “LINEARRING” ...
● Envelope()
– Polygon consisting of corner points of bounding box:
((MINX, MINY), (MAXX, MINY), (MAXX, MAXY),
(MINX, MAXY), (MINX, MINY))
● AsText()
– Returns string representation of the geometry in
Well-Known Text (WKT) format
● ... and a few other basic methods
5. SFS Methods : Spatial Relations
● Intersects(anotherGeometry : Geometry)
– Returns true if this Geometry 'spatially intersects'
anotherGeometry.
● Touches(anotherGeometry : Geometry)
– Returns true if this Geometry 'spatially touches'
anotherGeometry.
● Contains(anotherGeometry : Geometry)
– Returns true if this Geometry 'spatially contains'
anotherGeometry.
● ... and a few other spatial relational methods:
– Equals(...), Disjoint(...), Crosses(...), Within(...),
Overlaps(...), and Relate(...)
6. SFS Methods : Spatial Analysis
● Distance(anotherGeometry : Geometry)
– Return shortest distance between this Geometry and
anotherGeometry.
● Union(anotherGeometry : Geometry)
– Returns the point set union of this Geometry and
anotherGeometry.
● Difference(anotherGeometry : Geometry)
– Returns the point set difference of this Geometry and
anotherGeometry.
● ... and a few other spatial relational methods:
– SymDifference(anotherGeometry : Geometry),
Buffer(distance : Double), ConvexHull( ), ...
7. “Not Yet Implemented”
● The OpenGIS SFS specification is great, but...
– ... the spatial extensions are only available as of
MySQL 4.1.x
– ... and the SFS specification is not fully
implemented.
● Many of the spatial relations and analysis methods are
“not yet implemented.”
– This is understandable given the fact that “robust”
implementations of these methods are not easy to
create.
9. GML : Geography Markup Language
● Another OpenGIS specification used to format Simple
Features in XML
– XSLT available to translate GML to WKT
– ... and MySQL INSERT commands
10. Links
● Open Geospatial Consortium, Inc. (OGC)
http://www.opengeospatial.org/
● OGC: Simple Features - SQL (SFS)
http://www.opengeospatial.org/docs/99-049.pdf
● Spatial Extensions in MySQL
http://dev.mysql.com/doc/mysql/en/spatial-extensions-in-mysql.html
●
Geography Markup Language (GML3.0)
http://www.opengeospatial.org/specs/?page=specs
● JTS Topology Suite
http://www.vividsolutions.com/jts/JTSHome.htm