我想从表格中提取形状数据。我可以获得实体、numpts、minx、miny 除了 POINTS 之外的所有属性,即 BLOB。我想获取 varchar 形式的数据。如何提取 sd.st_geometry 列中的点属性值?
这是我的桌子
CREATE TABLE X
(
OBJECTID INTEGER NOT NULL,
GRID_ID VARCHAR2(17 BYTE),
H3_10_INT_ID VARCHAR2(256 BYTE),
CITY_NAME VARCHAR2(30 BYTE),
DISTRICT_NAME VARCHAR2(30 BYTE),
NEIGHBOURHOOD_NAME VARCHAR2(50 BYTE),
SHAPE SDE.ST_GEOMETRY
)
LOB ("SHAPE"."POINTS") STORE AS SECUREFILE (
TABLESPACE TBS_X
ENABLE STORAGE IN ROW
CHUNK 8192
CACHE
LOGGING
STORAGE (
INITIAL 104K
NEXT 1M
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
))
TABLESPACE TBS_X
PCTUSED 0
PCTFREE 0
INITRANS 4
MAXTRANS 255
STORAGE (
INITIAL 400K
NEXT 1M
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
)
LOGGING
NOCOMPRESS
NOCACHE
MONITORING;
这是表格的一个示例。
插入X (OBJECTID、GRID_ID、H3_10_INT_ID、CITY_NAME、 DISTRICT_NAME、NEIGHBOURHOOD_NAME) 价值观 (133, '8a1ec8000537fff', '622038258059280383', 55498, '泰基尔达', “苏莱曼帕夏”、“奥斯曼利”); 提交;
双击时您可以看到示例形状对象
SELECT objectid,sde.st_entity(SHAPE),sde.st_numpoints(SHAPE),
sde.st_minx(SHAPE),sde.st_miny(SHAPE),sde.st_maxx(SHAPE),sde.st_maxy(SHAPE),sde.st_minz(SHAPE),sde.st_maxz(SHAPE),sde.st_maxm(SHAPE),sde.st_area(SHAPE),
sde.st_length(SHAPE),
sde.st_srid(SHAPE)
FROM X
如果您有样本数据:
CREATE TABLE X
(
OBJECTID INTEGER NOT NULL,
SHAPE ST_GEOMETRY
);
INSERT INTO x (objectid, shape)
VALUES (
1,
ST_LINESTRING(
ST_POINT_ARRAY(
ST_POINT(1, 2, 4326),
ST_POINT(3, 4, 4326),
ST_POINT(5, 6, 4326)
)
)
);
然后你可以使用:
SELECT objectid,
TREAT(x.shape AS ST_LINESTRING).ST_NUMPOINTS() AS numpoints,
p.*
FROM x
CROSS JOIN LATERAL (
SELECT p.st_x() AS x,
p.st_y() AS y
FROM TABLE(TREAT(x.shape AS ST_LINESTRING).ST_POINTS()) p
) p
哪个输出:
对象ID | NUMPOINTS | X | 是 |
---|---|---|---|
1 | 3 | 1 | 2 |
1 | 3 | 3 | 4 |
1 | 3 | 5 | 6 |