更新时间:2024-10-26 GMT+08:00

空间数据类型

概述

MySQL具有对应于OpenGIS类的空间数据类型。DSC工具支持以下列出类型转换。

类型对照

表1 空间数据类型对照表

MySQL空间数据类型

MySQL INPUT

GaussDB(DWS) OUTPUT

GEOMETRY

GEOMETRY

GEOMETRY

POINT

POINT

POINT

LINESTRING

LINESTRING

POLYGON

POLYGON

POLYGON

POLYGON

MULTIPOINT

MULTIPOINT

BOX

MULTILINESTRING

MULTILINESTRING

BOX

MULTIPOLYGON

MULTIPOLYGON

POLYGON

GEOMETRYCOLLECTION

GEOMETRYCOLLECTION

GEOMETRYCOLLECTION

  • GEOMETRY可以存储任何类型的几何值。其他单值类型(POINT, LINESTRING和POLYGON)将其值限制为特定的几何类型。
  • GEOMETRYCOLLECTION可以存储任何类型的对象的集合。其他集合类型(MULTIPOINT, MULTILINESTRING, MULTIPOLYGON,和 GEOMETRYCOLLECTION)限制集合成员像那些具有特定的几何形状的类型。
  • 输入示例

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    CREATE TABLE `t_geo_test2`  (
      `id` int(11) NOT NULL,
      `name` varchar(255),
      `geometry_1` geometry NOT NULL,
      `point_1` point NOT NULL,
      `linestring_1` linestring NOT NULL,
      `polygon_1` polygon NOT NULL,
      `multipoint_1` multipoint NOT NULL,
      `multilinestring_1` multilinestring NOT NULL,
      `multipolygon_1` multipolygon NOT NULL,
      `geometrycollection_1` geometrycollection NOT NULL,
      PRIMARY KEY (`id`) USING BTREE
    ) ENGINE = InnoDB;
    

    输出示例

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    CREATE TABLE "public"."t_geo_test2"
    (
      "id" INTEGER(11) NOT NULL,
      "name" VARCHAR(255),
      "geometry_1" GEOMETRY NOT NULL,
      "point_1" POINT NOT NULL,
      "linestring_1" POLYGON NOT NULL,
      "polygon_1" POLYGON NOT NULL,
      "multipoint_1" BOX NOT NULL,
      "multilinestring_1" BOX NOT NULL,
      "multipolygon_1" POLYGON NOT NULL,
      "geometrycollection_1" GEOMETRYCOLLECTION NOT NULL,
      PRIMARY KEY ("id")
    )
      WITH ( ORIENTATION = ROW, COMPRESSION = NO )
      NOCOMPRESS
      DISTRIBUTE BY HASH ("id");