达梦数据库 DM_GEOM_CENTER使用
时间: 2024-07-30 16:01:32 浏览: 179
DM_GEOM_CENTER是达梦数据库 (DM) 中的一个函数,它主要用于处理几何数据类型(如 GEOMETRY 或 GEOSGeometry)。这个函数的主要作用是对给定的几何对象(例如点、线、面等)计算中心点坐标,返回的结果通常是几何对象的几何中心位置。
在 SQL 查询中,如果你有一个包含几何字段的数据表,比如 `geography_table`,并且你想获取其中某个地理要素的中心,你可以这样使用:
```sql
SELECT DM_GEOM_CENTER(geography_column) AS center_point
FROM geography_table;
```
这里的 `geography_column` 需替换为你实际表中的几何列名。
相关问题
纠正这段代码的错误:#针对fid=126的文件过大,重新还原 final_geom=pd.read_csv('/content/drive/MyDrive/touying_fishnet_832_1km_final-cropWGS84-GLC30/Target_126'+'test10-15.csv') final_geom2=pd.read_csv('/content/drive/MyDrive/touying_fishnet_832_1km_final-cropWGS84-GLC30/Target_126'+'test16-20.csv') inter_1=pd.concat([final_geom.iloc[:,5:17],final_geom.iloc[:,23:41]], axis=1) inter_2=pd.concat([final_geom2.iloc[:,5:15],final_geom2.iloc[:,21:36]], axis=1) merge=pd.concat([inter_1,inter_2], axis=1) merge.columns base=pd.concat([base,final_geom.iloc[:,17:23]], axis=1) for i in ['crop','forest','impervious']: for j in range(10,21): c_name=str(str(i)+str(j)) # print(c_name) base[c_name]=merge.loc[:,c_name] base=pd.concat([base,final_geom.iloc[:,-3:]], axis=1) base.columns base.to_csv('/content/drive/MyDrive/touying_fishnet_832_1km_final-cropWGS84-GLC30/Target_126'+'test10-20.csv')
纠正后的代码如下:
```
# 针对fid=126的文件过大,重新还原
final_geom=pd.read_csv('/content/drive/MyDrive/touying_fishnet_832_1km_final-cropWGS84-GLC30/Target_126'+'/test10-15.csv')
final_geom2=pd.read_csv('/content/drive/MyDrive/touying_fishnet_832_1km_final-cropWGS84-GLC30/Target_126'+'/test16-20.csv')
inter_1=pd.concat([final_geom.iloc[:,5:17],final_geom.iloc[:,23:41]], axis=1)
inter_2=pd.concat([final_geom2.iloc[:,5:15],final_geom2.iloc[:,21:36]], axis=1)
merge=pd.concat([inter_1,inter_2], axis=1)
base=pd.concat([base,final_geom.iloc[:,17:23]], axis=1)
for i in ['crop','forest','impervious']:
for j in range(10,21):
c_name=str(i)+str(j)
# print(c_name)
base[c_name]=merge.loc[:,c_name]
base=pd.concat([base,final_geom.iloc[:,-3:]], axis=1)
base.to_csv('/content/drive/MyDrive/touying_fishnet_832_1km_final-cropWGS84-GLC30/Target_126'+'/test10-20.csv', index=False)
```
主要修改的地方有:
1. 在读取文件路径的时候,将字符串拼接符号 `+` 改为了 `/`。
2. 在最后一行保存文件时,加了参数 `index=False`,不保存行索引。
3. 在合并数据时,将字符串拼接符号 `+` 改为了 `str()` 函数。
4. 将变量 `merge` 与变量 `base` 合并时,加了参数 `axis=1`,表示按列拼接。
SELECT vector FROM vector_tile ( 'PUBLIC', 'division_info_tbl_tmp', 8, 213, 103, SELECT ST_AsMVTGeom ( geom_3857, $1 ) AS geom, division_code FROM PUBLIC.division_info_tbl_tmp WHERE ST_Intersects ( geom_3857, $2 ) AND division_level = '1' ) SELECT ST_AsMVT ( mvt_geom.*, $3 ) AS tile FROM mvt_geom; ( String ) ) vector
这似乎是一个 SQL 查询语句,但是它存在一些语法错误。其中 SELECT 语句被放在了 vector_tile 函数的参数中,这是不正确的。正确的查询语句应该是:
```
SELECT vector FROM vector_tile (
'PUBLIC',
'division_info_tbl_tmp',
8,
213,
103,
'PUBLIC',
'division_info_tbl',
8,
213,
103,
'WITH mvt_geom AS (
SELECT ST_AsMVTGeom(geom_3857, $1) AS geom, division_code
FROM PUBLIC.division_info_tbl_tmp
WHERE ST_Intersects(geom_3857, $2) AND division_level = ''1''
)
SELECT ST_AsMVT(mvt_geom.*, $3) AS tile
FROM mvt_geom'
);
```
这个查询语句首先指定了 vector_tile 函数的参数,然后使用 WITH 子句定义了一个名为 mvt_geom 的临时表,该表包含满足条件的矢量数据。最后,使用 ST_AsMVT 函数将数据转换为 MVT 格式,并将结果命名为 tile。
阅读全文
相关推荐
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)