Postgis ST_Transform

时间:2014-04-14 13:14:05

标签: gis postgis

我有一个点(x,y)与srid 900913.我将它转换为srid 2180然后再转换为srid 900913.Imo我应该有相同的观点,但它有所不同。为什么呢?

SELECT ST_X (ST_Transform(ST_Transform(ST_GeomFromText('POINT(21.01233628836129 52.23044648850736)', 900913), 2180), 900913)),
ST_Y(ST_Transform(ST_Transform(ST_GeomFromText('POINT(21.01233628836129 52.23044648850736)', 900913), 2180), 900913));

1 个答案:

答案 0 :(得分:1)

为什么两种变换不同的快速答案是由于投影系统的常见混淆。

Spherical Mercator projection上的坐标POINT(21.01233628836129 52.23044648850736)位于0°0'1.689"N 0°0'0.680"E,这是波兰以外的方式,这使得将其重新投影到任何地方很困难或通常无法实现其他

您正在查看的坐标<{3>} 很可能是经度/纬度。

我认为这是您尝试的练习(特别是LatLon_check):

SELECT ST_AsLatLonText(geom) AS LatLonText,
  ST_AsLatLonText(ST_Transform(ST_Transform(geom, 2180), 4326)) as LatLon_check,
  ST_AsText(ST_Transform(geom, 2180)) AS Poland_CS92,
  ST_AsText(ST_Transform(geom, 900913)) AS Spherical_Mercator
FROM ST_GeomFromText('POINT(21.01233628836129 52.23044648850736)', 4326) AS geom;

-[ RECORD 1 ]------+----------------------------------------
latlontext         | 52°13'49.607"N 21°0'44.411"E
latlon_check       | 52°13'49.607"N 21°0'44.411"E
poland_cs92        | POINT(637389.203455155 486840.46005323)
spherical_mercator | POINT(2339082.5759974 6841900.8700405)