我在德国中部创建了一个非常简单的多边形来展示我的问题。
您可以使用以下GeoJSON
在geojsonlint中将其可视化{"type":"Polygon","coordinates":[[
[10.439844131469727,51.17460781257472],
[10.430574417114258,51.1753073564544],
[10.429565906524658,51.17179607723465],
[10.438792705535889,51.170706315523866],
[10.439372062683105,51.17267055874809],
[10.43975830078125,51.17439256616884],
[10.439844131469727,51.17460781257472]]]G}
使用在线工具计算表面时(例如http://www.daftlogic.com/projects-google-maps-area-calculator-tool.htm,但我试过几次), 我得到以下数字(这些是基于多边形的类似绘图,但不完全相同,因为我无法将其复制到这些工具):
现在我想用POSTGIS计算这些区域,但我总是出错并且不匹配数字。
首先,我使用此处给出的示例开始没有转换:
http://postgis.net/docs/ST_Area.html
SELECT ST_Area(the_geom) As sqft, ST_Area(the_geom)*POWER(0.3048,2) As sqm
FROM (SELECT ST_GeomFromText('
POLYGON ((51.17460781257472 10.439844131469727,
51.1753073564544 10.430574417114258,
51.17179607723465 10.429565906524658,
51.170706315523866 10.438792705535889,
51.17267055874809 0.439372062683105,
51.17439256616884 10.43975830078125,
51.17460781257472 10.439844131469727))',4326) ) As foo(the_geom);
- >平方英尺= 3.52643124351653e-05和平方米= 3.27616182873666e-06
我如何解释这些数字? 然后我尝试将其转换为WGS 84 / UTM区域33N 32633
SELECT ST_Area(the_geom) As sqft, ST_Area(the_geom)*POWER(0.3048,2) As sqm
FROM (SELECT ST_Transform(ST_GeomFromText('
POLYGON ((51.174661624019286 10.440187454223633,
51.17067940750161 10.438899993896484,
51.17197097486416 10.429544448852539,
51.17536116708255 10.430488586425781,
51.174661624019286 10.440187454223633))',4326),32633) ) As foo(the_geom);
- > sqft = 662918.939349234和sqm = 61587.1847391195
但即使这些数字也不会接近。
答案 0 :(得分:2)
答案 1 :(得分:1)
我将坐标转换为EPSG:31467,参见投影到米的epsg:31467并应用于几何所覆盖的德国地区。
select st_area(st_transform(st_setsrid(st_geomfromtext('POLYGON((10.439844131469727
51.17460781257472,10.430574417114258 51.1753073564544,10.429565906524658
51.17179607723465,10.438792705535889 51.170706315523866, 10.439372062683105
51.17267055874809, 10.43975830078125 51.17439256616884, 10.439844131469727
51.17460781257472))'),4326),31467));
得到答案:274442.27 m 2 ,这是原答案的0.007%。
在使用适合该区域的大地水准面的投影坐标系中,测量通常更准确。如果您在Postgis中为该投影在空间参考系统表上运行此查询:
select * from spatial_ref_sys where srid=31467;
您将看到更多细节,例如它使用贝塞尔1841球体。
编辑:您的原始geojson具有x / y坐标,但出于某种原因,在将它们放入Postgis时将它们翻转。