Mysql几何体AREA()函数返回什么时候coords是long / lat? [英] Mysql geometry AREA() function returns what exactly when coords are long/lat?

查看:215
本文介绍了Mysql几何体AREA()函数返回什么时候coords是long / lat?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



使用Mysql Geometry字段存储一个小的多边形,并正常运行

  select AREA(myPolygon)where id = 1 

,并获得了2.345的值。所以任何人都可以告诉我,这个数字代表什么,因为存储的值是描述多边形的长/长集? FYI,我工作的区域是相对较小(停车场之类)和该地区并不一定是确切的 - 我不会关心地球的曲率。

<2.345什么?谢谢,这是我的烦恼。

解决方案

简单的答案是你的面积计算单位基本上是毫无意义的diff] * [deg lon diff])。即使地球曲率不会用于面积计算(因为您的面积很小),它对计算经纬度多边形坐标之间的距离起到了作用。

由于经度与基于赤道的距离不同( http://en.wikipedia.org/wiki/Longitude#Degree_length ),实际上并没有将你的区域直接转换为m ^ 2或km ^ 2。它取决于赤道南/北部的距离。如果你总是有矩形的多边形,你可以存储对角坐标并使用这样的东西计算面积: PHP库:计算边界框对于给定的纬度/经度位置



最正确的做法是使用XY(米)坐标存储多边形(可能使用UTM WGS-84椭圆体),它可以使用各种库如纬度/经度计算,如下面的Java: Java,将经纬度转换为UTM 。您可以继续使用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:

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.

解决方案

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.

这篇关于Mysql几何体AREA()函数返回什么时候coords是long / lat?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆