地理学习
-
如果计算Polygon面积?
-
Area of a polygon (Coordinate Geometry),这是基于平面几何的计算公式
-
Area in KM from Polygon of coordinates,这是把GPS转换成(可以说是投影)平面坐标,然后计算。
-
Geographic Analysis in SQL: Measuring Polygon Area from Latitude and Longitude
-
To sum up what others said, when converting to Coordinate there are 3 main things to take care of:
- Projection. JTS works in a Cartesian plane, so all distortion from e.g. ==Mercator propagates== into your calculation. Thus, you should only use it on quite short-ranged area. I'm not sure about the precise magnitude, but I think everything below a degree of expansion should be fine. Stay below 0.1 degree and you're definitely on the safe side.
- Units. You can put perfectly any unit into JTS. The trouble is you can't tell JTS whether you're using meters, or degrees, or anything else. So you must take care yourself that you either stick to one unit, or convert wherever necessary.
- Standard. The ISO standard states that geospatial coordinates are provided lat first. However, it competes with the GeoJSON/WKT standards which both state lon first, so reverse. Both standard groups have applications sticking to them (for instance, Apache Lucene switched standards between releases without changing the method signature, thus causing headaches to hundreds of users wondering why their maps all of a sudden were flipped), and JTS is holding on the GeoJSON/WKT version. Pay attention to that wherever you pass the data from another library - it may follow GeoJSON and WKT, or ISO, you should inform yourself in advance. (Believe me. I already had trouble with this, and it can be really annoying going through the entire code and flipping the order.)