Documentation Home
MySQL 5.6 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 31.4Mb
PDF (A4) - 31.5Mb
PDF (RPM) - 30.0Mb
EPUB - 7.7Mb
HTML Download (TGZ) - 7.5Mb
HTML Download (Zip) - 7.5Mb
HTML Download (RPM) - 6.5Mb
Eclipse Doc Plugin (TGZ) - 8.2Mb
Eclipse Doc Plugin (Zip) - 10.1Mb
Man Pages (TGZ) - 180.9Kb
Man Pages (Zip) - 292.0Kb
Info (Gzip) - 2.8Mb
Info (Zip) - 2.8Mb
Excerpts from this Manual

MySQL 5.6 Reference Manual  /  ...  /  Spatial Operator Functions

12.15.8 Spatial Operator Functions

OpenGIS proposes a number of functions that can produce geometries. They are designed to implement spatial operators.

  • Buffer(g,d)

    ST_Buffer() and Buffer() are synonyms. For more information, see the description of ST_Buffer().

    Buffer() was added in MySQL 5.6.1.

  • ST_Buffer(g,d)

    Returns a geometry that represents all points whose distance from the geometry value g is less than or equal to a distance of d.

    ST_Buffer() supports negative distances for polygons, multipolygons, and geometry collections containing polygons or multipolygons. For point, multipoint, linestring, multilinestring, and geometry collections not containing any polygons or multipolygons, ST_Buffer() with a negative distance returns NULL.

    ST_Buffer() and Buffer() are synonyms.

    ST_Buffer() was added in MySQL 5.6.1.

  • ST_Difference(g1, g2)

    Returns a geometry that represents the point set difference of the geometry values g1 and g2.

    mysql> SET @g1 = POINT(1,1), @g2 = POINT(2,2);
    mysql> SELECT ST_AsText(ST_Difference(@g1, @g2));
    +------------------------------------+
    | ST_AsText(ST_Difference(@g1, @g2)) |
    +------------------------------------+
    | POINT(1 1)                         |
    +------------------------------------+
    

    ST_Difference() was added in MySQL 5.6.1.

  • ST_Intersection(g1, g2)

    Returns a geometry that represents the point set intersection of the geometry values g1 and g2.

    mysql> SET @g1 = ST_GeomFromText('LineString(1 1, 3 3)');
    mysql> SET @g2 = ST_GeomFromText('LineString(1 3, 3 1)');
    mysql> SELECT ST_AsText(ST_Intersection(@g1, @g2));
    +--------------------------------------+
    | ST_AsText(ST_Intersection(@g1, @g2)) |
    +--------------------------------------+
    | POINT(2 2)                           |
    +--------------------------------------+
    

    ST_Intersection() was added in MySQL 5.6.1.

  • ST_SymDifference(g1, g2)

    Returns a geometry that represents the point set symmetric difference of the geometry values g1 and g2, which is defined as:

    g1 symdifference g2 := (g1 union g2) difference (g1 intersection g2)
    

    Or, in function call notation:

    ST_SymDifference(g1, g2) = ST_Difference(ST_Union(g1, g2), ST_Intersection(g1, g2))
    
    mysql> SET @g1 = POINT(1,1), @g2 = POINT(2,2);
    mysql> SELECT ST_AsText(ST_SymDifference(@g1, @g2));
    +---------------------------------------+
    | ST_AsText(ST_SymDifference(@g1, @g2)) |
    +---------------------------------------+
    | MULTIPOINT(1 1,2 2)                   |
    +---------------------------------------+
    

    ST_SymDifference() was added in MySQL 5.6.1.

  • ST_Union(g1, g2)

    Returns a geometry that represents the point set union of the geometry values g1 and g2.

    mysql> SET @g1 = ST_GeomFromText('LineString(1 1, 3 3)');
    mysql> SET @g2 = ST_GeomFromText('LineString(1 3, 3 1)');
    mysql> SELECT ST_AsText(ST_Union(@g1, @g2));
    +--------------------------------------+
    | ST_AsText(ST_Union(@g1, @g2))        |
    +--------------------------------------+
    | MULTILINESTRING((1 1,3 3),(3 1,1 3)) |
    +--------------------------------------+
    

    ST_Union() was added in MySQL 5.6.1.

In addition, Section 12.15.7, “Geometry Property Functions”, discusses several functions that construct new geometries from existing ones. See that section for descriptions of these functions:


User Comments
Sign Up Login You must be logged in to post a comment.