mysql地理位置_mysql存储与计算地理位置信息

Area() Return Polygon or MultiPolygon area

AsBinary(), AsWKB() Convert from internal geometry format to WKB

AsText(), AsWKT() Convert from internal geometry format to WKT

Buffer()Return geometry of points within given distance from geometry

Centroid() Return centroid as a point

Contains() Whether MBR of one geometry contains MBR of another

Crosses() Whether one geometry crosses another

Dimension() Dimension of geometry

Disjoint() Whether MBRs of two geometries are disjoint

EndPoint() End Point of LineString

Envelope() Return MBR of geometry

Equals() Whether MBRs of two geometries are equal

ExteriorRing()Return exterior ring of Polygon

GeomCollFromText(),GeometryCollectionFromText()Return geometry collection from WKT

GeomCollFromWKB(),GeometryCollectionFromWKB()Return geometry collection from WKB

GeometryCollection() Construct geometry collection from geometries

GeometryN() Return N-th geometry from geometry collection

GeometryType() Return name of geometry type

GeomFromText(),GeometryFromText()Return geometry from WKT

GeomFromWKB(),GeometryFromWKB()Return geometry from WKB

GLength() Return length of LineString

InteriorRingN() Return N-th interior ring of Polygon

Intersects() Whether MBRs of two geometries intersect

IsClosed() Whether a geometry is closed and simple

IsEmpty() Placeholder_function

IsSimple() Whether a geometry is simple

LineFromText(),LineStringFromText()Construct LineString from WKT

LineFromWKB(),LineStringFromWKB()Construct LineString from WKB

LineString() Construct LineString from Point values

MBRContains() Whether MBR of one geometry contains MBR of another

MBRDisjoint() Whether MBRs of two geometries are disjoint

MBREqual() Whether MBRs of two geometries are equal

MBRIntersects() Whether MBRs of two geometries intersect

MBROverlaps() Whether MBRs of two geometries overlap

MBRTouches() Whether MBRs of two geometries touch

MBRWithin() Whether MBR of one geometry is within MBR of another

MLineFromText(),MultiLineStringFromText()Construct MultiLineString from WKT

MLineFromWKB(),MultiLineStringFromWKB()Construct MultiLineString from WKB

MPointFromText(),MultiPointFromText()Construct MultiPoint from WKT

MPointFromWKB(),MultiPointFromWKB()Construct MultiPoint from WKB

MPolyFromText(),MultiPolygonFromText()Construct MultiPolygon from WKT

MPolyFromWKB(),MultiPolygonFromWKB()Construct MultiPolygon from WKB

MultiLineString() Contruct MultiLineString from LineString values

MultiPoint() Construct MultiPoint from Point values

MultiPolygon() Construct MultiPolygon from Polygon values

NumGeometries() Return number of geometries in geometry collection

NumInteriorRings() Return number of interior rings in Polygon

NumPoints() Return number of points in LineString

Overlaps() Whether MBRs of two geometries overlap

Point() Construct Point from coordinates

PointFromText() Construct Point from WKT

PointFromWKB() Construct Point from WKB

PointN() Return N-th point from LineString

PolyFromText(),PolygonFromText()Construct Polygon from WKT

PolyFromWKB(), PolygonFromWKB() Construct Polygon from WKB

Polygon() Construct Polygon from LineString arguments

SRID() Return spatial reference system ID for geometry

ST_Area() Return Polygon or MultiPolygon area

ST_AsBinary(), ST_AsWKB() Convert from internal geometry format to WKB

ST_AsText(), ST_AsWKT() Convert from internal geometry format to WKT

ST_Buffer() Return geometry of points within given distance from geometry

ST_Centroid() Return centroid as a point

ST_Contains() Whether one geometry contains another

ST_Crosses() Whether one geometry crosses another

ST_Difference() Return point set difference of two geometries

ST_Dimension() Dimension of geometry

ST_Disjoint() Whether one geometry is disjoint from another

ST_Distance() The distance of one geometry from another

ST_EndPoint() End Point of LineString

ST_Envelope() Return MBR of geometry

ST_Equals() Whether one geometry is equal to another

ST_ExteriorRing() Return exterior ring of Polygon

ST_GeomCollFromText(),ST_GeometryCollectionFromText(),ST_GeomCollFromTxt()Return geometry collection from WKT

ST_GeomCollFromWKB(),ST_GeometryCollectionFromWKB()Return geometry collection from WKB

ST_GeometryN() Return N-th geometry from geometry collection

ST_GeometryType() Return name of geometry type

ST_GeomFromText(),ST_GeometryFromText()Return geometry from WKT

ST_GeomFromWKB(),ST_GeometryFromWKB()Return geometry from WKB

ST_InteriorRingN() Return N-th interior ring of Polygon

ST_Intersection() Return point set intersection of two geometries

ST_Intersects() Whether one geometry intersects another

ST_IsClosed() Whether a geometry is closed and simple

ST_IsEmpty() Placeholder_function

ST_IsSimple() Whether a geometry is simple

ST_LineFromText(),ST_LineStringFromText()Construct LineString from WKT

ST_LineFromWKB(),ST_LineStringFromWKB()Construct LineString from WKB

ST_NumGeometries() Return number of geometries in geometry collection

ST_NumInteriorRing(),ST_NumInteriorRings()Return number of interior rings in Polygon

ST_NumPoints() Return number of points in LineString

ST_Overlaps() Whether one geometry overlaps another

ST_PointFromText() Construct Point from WKT

ST_PointFromWKB() Construct Point from WKB

ST_PointN() Return N-th point from LineString

ST_PolyFromText(),ST_PolygonFromText()Construct Polygon from WKT

ST_PolyFromWKB(),ST_PolygonFromWKB()Construct Polygon from WKB

ST_SRID() Return spatial reference system ID for geometry

ST_StartPoint() Start Point of LineString

ST_SymDifference() Return point set symmetric difference of two geometries

ST_Touches() Whether one geometry touches another

ST_Union() Return point set union of two geometries

ST_Within() Whether one geometry is within another

ST_X() Return X coordinate of Point

ST_Y() Return Y coordinate of Point

StartPoint() Start Point of LineString

Touches() Whether one geometry touches another

Within() Whether MBR of one geometry is within MBR of another

X() Return X coordinate of Point

Y() Return Y coordinate of Point

MySQL支持地理空间信息存储和查询。你可以使用MySQL的地理空间展来处理地理空间数据类型,点、线、多边形等。 要使用理空间功能,你需要确保你的版本支持地理空间扩展。在装MySQL时,需要选择启用地理空间支持,或者在已安装的MySQL上启用地理空间插件。 一旦你的MySQL服务器支持地理空间扩展,你可以创建具有地理空间属性的表,并将地理空间数据存储在其中。下面是一个创建包含地理空间列的表的示例: ```sql CREATE TABLE locations ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), location GEOMETRY ); ``` 在这个例子中,`location`列被定义为`GEOMETRY`类型,用于存储地理空间数据。 要查询地理空间数据,你可以使用一些MySQL提供的函数和操作符。例如,你可以使用 `ST_DISTANCE()` 函数计算两个点之间的距离,使用 `ST_CONTAINS()` 函数判断一个点是否在一个多边形内等等。 以下是一个简单的查询示例,找出距离给定坐标最近的位置: ```sql SELECT id, name, ST_DISTANCE(location, POINT(40.7128, -74.0060)) AS distance FROM locations ORDER BY distance LIMIT 1; ``` 这个查询将返回距离给定坐标(纬度40.7128,经度-74.0060)最近的位置的id、名称和距离。 这只是地理空间功能的简单介绍,MySQL提供了更多的函数和操作符来处理地理空间数据。你可以查阅MySQL官方文档以获得更详细的信息和示例。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值