PostGIS位置定位错误

时间:2013-02-15 18:10:16

标签: postgis

我不确定这是否是正确的问题,但我想我会试一试。我有一个导入到PostGIS中的世界地图shapefile以及我在测试表中添加的几个点。这些应该在英国,但它们就在马达加斯加海岸附近。我显然做错了什么,但看着两张桌子的ogrinfo,我得到了:

Layer name: countries
Geometry: 3D Multi Polygon
Feature Count: 525
Extent: (-180.000000, -89.999933) - (180.000000, 84.134162)
Layer SRS WKT:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0,
        AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9122"]],
    AUTHORITY["EPSG","4326"]]
FID Column = gid
Geometry Column = geom
scalerank: Integer (2.0)
featurecla: String (32.0)
name: String (254.0)
namealt: String (254.0)
region: String (50.0)
subregion: String (50.0)


INFO: Open of `PG:dbname=g4wd'
      using driver `PostgreSQL' successful.

Layer name: test
Geometry: 3D Point
Feature Count: 2
Extent: (51.009400, -2.638900) - (51.571400, 0.695600)
Layer SRS WKT:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0,
        AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9122"]],
    AUTHORITY["EPSG","4326"]]
Geometry Column = location
id: Integer (0.0)
name: String (25.0)

所以我对我应该检查的内容感到很困惑。有人知道我需要检查或做什么,因为所有的prj信息似乎都是正确的吗?

编辑:添加了geometry_columns详细信息 - 不确定是否相关。

g4wd=# select * from geometry_columns;
 f_table_catalog | f_table_schema | f_table_name | f_geometry_column | coord_dimension | srid |     type     
-----------------+----------------+--------------+-------------------+-----------------+------+--------------
 g4wd            | public         | test         | location          |               2 | 4326 | POINT
 g4wd            | public         | countries    | geom              |               2 | 4326 | MULTIPOLYGON

1 个答案:

答案 0 :(得分:0)

test的坐标数据需要转置(Y,X) - > (X,Y),因为PostGIS(和大多数其他GIS软件)的轴顺序是经度,纬度(不是其他方式!)。

如果已加载此数据,请使用此SQL更新语句交换轴顺序:

UPDATE test SET
  location = ST_SetSRID(ST_MakePoint(ST_Y(location), ST_X(location)), 4326);