当坐标为长/纬度时,Mysql 几何 AREA() 函数返回什么?

我的问题与 这个类似的,它链接到一个非常复杂的解决方案 - 但我想了解的是这个结果:

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:

使用 Mysql Geometry 字段存储我适当运行的小多边形

Using a Mysql Geometry field to store a small polygon I duly ran

select AREA(myPolygon) where id =1 

在它上面,得到一个像 2.345 这样的值.那么谁能告诉我,当存储的值是描述多边形的长/纬度集时,这个数字代表什么?

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 什么?谢谢,这让我很烦.

2.345 of what? Thanks, this is bugging me.

推荐答案

简短的回答是面积计算的单位基本上没有意义([deg lat diff] * [deg lon diff]).即使地球的曲率不会在面积计算中起作用(因为您的面积很小"),但它确实在计算纬度/经度多边形坐标之间的距离时起作用.

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.

由于距离赤道的距离不同,经度也不同 (http://en.wikipedia.org/wiki/Longitude#Degree_length),实际上没有将您的区域直接转换为 m^2 或 km^2.它取决于赤道北/南的距离.

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.

如果你总是有矩形多边形,你可以只存储对角坐标并使用这样的东西计算面积:PHP 库:计算给定 lat/lng 位置的边界框

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

最正确"的做法是使用 XY(米)坐标(可能是 UTM 使用 WGS-84 椭球体)存储多边形,可以使用以下各种库从 lat/lon 计算出 Java:Java,将纬度/经度转换为 UTM.然后您可以继续使用 MySQL AREA() 函数.

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.

相关文章