地理位置操作
添加地理位置
参数
类型
必填
说明
// 1. 直接使用数字
GeoPolygon polygon = new GeoPolygon(coordinates: [[10, 10], [20, 10], [30, 20], [10, 10]]);
// 2. 借助 GeoPoint
GeoPoint point1 = new GeoPoint(10, 10);
...
GeoPolygon polygon = new GeoPolygon(points: [point1, point2, point3, point1]);TableObject tableObject = new TableObject(tableName);
TableRecord record = tableObject.create();
// 保存一个点
GeoPoint point = new GeoPoint(10, 10);
record.set('geo_point', point);
record.save();
// 保存一个多边形
GeoPolygon polygon = new GeoPolygon(coordinates: [[10, 10], [20, 10], [30, 20], [10, 10]]); // 前后两点相同,即需构成一个闭环
// or
GeoPoint point1 = new GeoPoint(10, 10);
//...
polygon = new GeoPolygon(points: [point1, point2, point3, point1]);
record.set('geo_polygon', polygon);
record.save();地理位置查询
Last updated
Was this helpful?