Ryan Lambert: Accuracy of Geometry data in PostGIS

原文英文,约1300词,阅读约需5分钟。发表于:

A common use case with PostGIS data is to calculate things, such as distances between points, lengths of lines, and the area of polygons. The topic of accuracy, or inaccuracy, with GEOMETRY data comes up often. The most frequent offenders are generic SRIDs such as 3857 and 4326. In some projects accuracy is paramount. Non-negotiable. On the other hand, plenty of projects do not need accurate calculations. Those projects often rely on relationships between calculations, not the actual values of the calculations themselves. If Coffee shop Y is 4 times further away than Coffee shop Z. I'll often go to Coffee shop Z just based on that. In most cases, users should still understand how significant the errors are. This post explores one approach to determine the how accurate (or not!) the calculations of a given SRID are in a particular region, based on latitude (North/South). The queries used in this post can be adjusted for your specific area. Set the stage The calculations in this post focus on the distance of two points situated 40 decimal degrees apart. The points are created in pairs of west/east points at -120 (W) and -80 (W). Those were picked arbitrarily, though intentionally spread far enough apart to make the errors in distance calculations feel obviously significant. The point pairs are created in 5 decimal degree intervals of latitude from 80 North to 80 South. The following screenshot shows how the points frame in much of North America. While the points on the map using a mercator projection appear to be equidistant... they are not!

本文探讨了PostGIS数据中几何数据的精度问题,特别是通用SRIDs的精度问题。文章发现SRID 3857在赤道附近的误差率基本为零,但在60度南/北时误差率超过100%。建议使用本地化的SRIDs可以获得更准确的计算结果。提供了一些查询语句,可以帮助读者验证自己的计算精度。

Ryan Lambert: Accuracy of Geometry data in PostGIS
相关推荐 去reddit讨论