当坐标为长/纬度时,Mysql 几何 AREA() 函数到底返回什么?
我的问题与 这个类似的,它链接到一个非常复杂的解决方案 - 但我想了解的是这样的结果:
Using a Mysql Geometry field to store a Small Polygon I doly run
select AREA(myPolygon) where id =1
over它,并得到了像 2.345 这样的值。那么谁能告诉我,当存储的值是描述多边形的长/纬度集时,这个数字代表什么?
仅供参考,我正在研究的区域相对较小(停车场等),并且区域不必精确 - 我不会担心地球的曲率。
2.345 什么?谢谢,这让我很烦恼。
My question is somewhat related to this similar one, which links to a pretty complex solution - but what I want to understand is the result of this:
Using a Mysql Geometry field to store a small polygon I duly ran
select AREA(myPolygon) where id =1
over it, and got an value like 2.345. So can anyone tell me, just what does that number represent seeing as the stored values were long/lat sets describing the polygon?
FYI, the areas I am working on are relatively small (car parks and the like) and the area does not have to be exact - I will not be concerned about the curvature of the earth.
2.345 of what? Thanks, this is bugging me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简而言之,面积计算的单位基本上没有意义([deg lat diff] * [deg lon diff])。尽管地球的曲率不会参与面积计算(因为您的面积“小”),但它确实会参与纬度/经度多边形坐标之间的距离的计算。
由于经度根据距赤道的距离而不同(http://en.wikipedia .org/wiki/Longitude#Degree_length),实际上并没有直接将面积转换为 m^2 或 km^2。它取决于赤道南北的距离。
如果你总是有矩形多边形,你可以只存储对角坐标并使用如下方法计算面积: PHP 库:计算给定 lat/lng 位置的边界框
最“正确”的做法是使用 XY 存储多边形(米)坐标(可能是使用 WGS-84 椭球体的 UTM),可以使用各种库从纬度/经度计算,如以下 Java 库: Java,将纬度/经度转换为 UTM。然后您可以继续使用 MySQL AREA() 函数。
The short answer is that the units for your area calculation are basically meaningless ([deg lat diff] * [deg lon diff]). Even though the curvature of the earth wouldn't come into play for the area calculation (since your areas are "small"), it does come into play for the calculation of distance between the lat/lon polygon coordinates.
Since a degree of longitude is different based on the distance from the equator (http://en.wikipedia.org/wiki/Longitude#Degree_length), there really is no direct conversion of your area into m^2 or km^2. It is dependent on the distance north/south of the equator.
If you always have rectangular polygons, you could just store the opposite corner coordinates and calculate area using something like this: PHP Library: Calculate a bounding box for a given lat/lng location
The most "correct" thing to do would be to store your polygons using X-Y (meters) coordinates (perhaps UTM using the WGS-84 ellipsoid), which can be calculated from lat/lon using various libraries like the following for Java: Java, convert lat/lon to UTM. You could then continue to use the MySQL AREA() function.