MySQL 5.1 リファレンスマニュアル :: 16 Spatial Extensions :: 16.5 Analyzing Spatial Information :: 16.5.2 Geometry Functions :: 16.5.2.7 GeometryCollection Functions
« 16.5.2.6 MultiPolygon Functions

16.5.3 Functions That Create New Geometries from Existing Ones »
Section Navigation      [Toggle]
  • 16.5.2 Geometry Functions
  • 16.5.2.1 General Geometry Functions
  • 16.5.2.2 Point Functions
  • 16.5.2.3 LineString Functions
  • 16.5.2.4 MultiLineString Functions
  • 16.5.2.5 Polygon Functions
  • 16.5.2.6 MultiPolygon Functions
  • 16.5.2.7 GeometryCollection Functions

16.5.2.7. GeometryCollection Functions

  • GeometryN(gc,N)

    Returns the N-th geometry in the GeometryCollection value gc. Geometries are numbered beginning with 1.

    mysql> SET @gc = 'GeometryCollection(Point(1 1),LineString(2 2, 3 3))';
    mysql> SELECT AsText(GeometryN(GeomFromText(@gc),1));
    +----------------------------------------+
    | AsText(GeometryN(GeomFromText(@gc),1)) |
    +----------------------------------------+
    | POINT(1 1)                             |
    +----------------------------------------+
    
  • NumGeometries(gc)

    Returns the number of geometries in the GeometryCollection value gc.

    mysql> SET @gc = 'GeometryCollection(Point(1 1),LineString(2 2, 3 3))';
    mysql> SELECT NumGeometries(GeomFromText(@gc));
    +----------------------------------+
    | NumGeometries(GeomFromText(@gc)) |
    +----------------------------------+
    |                                2 |
    +----------------------------------+
    
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