mysql

MySQL中Geometry数据的导入导出方法

小樊
141
2024-08-15 10:20:33
栏目: 云计算

  1. 导入Geometry数据:
LOAD DATA INFILE 'path/to/your/file.csv'
INTO TABLE your_table
FIELDS TERMINATED BY ',' ENCLOSED BY '"'
LINES TERMINATED BY '\n'
(column1, column2, @geo_data)
SET geometry_column = ST_GeomFromText(@geo_data);
  1. 导出Geometry数据:
SELECT column1, column2, ST_AsText(geometry_column) AS geo_data
INTO OUTFILE 'path/to/your/export/file.csv'
FIELDS TERMINATED BY ',' ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM your_table;

0
看了该问题的人还看了