"geographyFromText": "ST_GeomFromText(@stFromText)",
"geographyAsText": "ST_AsText({st_col_name}) {st_col_name}",
"geographySrid": 4326,
"geographyWkid": 4326,
"geographyPoint": "CONCAT('POINT(',{st_lng},' ',{st_lat},')')",
"geographyLine": "LINESTRING({st_line}))",
"geographyPolygon": "POLYGON(({st_area}))",
"geographyDistance": "ST_DISTANCE_SPHERE(ST_GeomFromText(@stStartLngLat),ST_GeomFromText(@stEndLngLat))",
"geographyDbDistance": "ST_DISTANCE_SPHERE({st_geography},ST_GeomFromText(@stEndLngLat))",
"geographyArea": "ST_Area(ST_GeomFromText(@stPolygon))",
"geographyDbArea": "({st_geography})",
"nullSql": "IFNULL({null_o},{null_new})"
创建表
插入点
insert into demo1(id,geometry ) values(1,ST_GeomFromText(CONCAT('POINT(','120.32',' ','23.90',')')));
insert into demo1(id,geometry ) values(1,ST_GeomFromText(CONCAT('POINT(','121.32',' ','23.80',')')));
计算两点距离
select ST_DISTANCE_SPHERE(ST_GeomFromText(CONCAT('POINT(','120.32',' ','23.90',')')),ST_GeomFromText(CONCAT('POINT(','121.32',' ','23.80',')')))
文档更新时间: 2022-12-26 08:14 作者:admin