MySQL 5.1 リファレンスマニュアル :: 16 Spatial Extensions :: 16.5 Analyzing Spatial Information :: 16.5.1 Geometry Format Conversion Functions
« 16.5 Analyzing Spatial Information

16.5.2 Geometry Functions »
Section Navigation      [Toggle]
  • 16.5 Analyzing Spatial Information
  • 16.5.1 Geometry Format Conversion Functions
  • 16.5.2 Geometry Functions
  • 16.5.3 Functions That Create New Geometries from Existing Ones
  • 16.5.4 Functions for Testing Spatial Relations Between Geometric Objects
  • 16.5.5 Relations on Geometry Minimal Bounding Rectangles (MBRs)
  • 16.5.6 Functions That Test Spatial Relationships Between Geometries

16.5.1. Geometry Format Conversion Functions

MySQL supports the following functions for converting geometry values between internal format and either WKT or WKB format:

  • AsBinary(g)

    Converts a value in internal geometry format to its WKB representation and returns the binary result.

    SELECT AsBinary(g) FROM geom;
    
  • AsText(g)

    Converts a value in internal geometry format to its WKT representation and returns the string result.

    mysql> SET @g = 'LineString(1 1,2 2,3 3)';
    mysql> SELECT AsText(GeomFromText(@g));
    +--------------------------+
    | AsText(GeomFromText(@g)) |
    +--------------------------+
    | LINESTRING(1 1,2 2,3 3)  |
    +--------------------------+
    
  • GeomFromText(wkt[,srid])

    Converts a string value from its WKT representation into internal geometry format and returns the result. A number of type-specific functions are also supported, such as PointFromText() and LineFromText(). See 項16.4.2.1. 「Creating Geometry Values Using WKT Functions」.

  • GeomFromWKB(wkb[,srid])

    Converts a binary value from its WKB representation into internal geometry format and returns the result. A number of type-specific functions are also supported, such as PointFromWKB() and LineFromWKB(). See 項16.4.2.2. 「Creating Geometry Values Using WKB Functions」.

Copyright © 1997, 2010, Oracle and/or its affiliates. All rights reserved. Legal Notices
Top / Previous / Next / Up / Table of Contents
© 2010, Oracle Corporation and/or its affiliates