postgis形状文件导入问题

发布于 2024-11-30 17:44:47 字数 1109 浏览 2 评论 0原文

您好,我正在尝试从

http://www. nyc.gov/html/dcp/html/bytes/bytesarchive.shtml

到 postgis 数据库中。当我使用 shp2pgsql 导入时,上述文件会创建 MULTIPOLYGONS。

然后我试图简单地确定纬度/经度点是否包含在我的多边形中,

但是我的选择不起作用,当我打印出 the_geom 列的点时,它似乎非常损坏。

select st_astext(geom) from (select (st_dumppoints(the_geom)).* from nybb where borocode =1) foo;

给出结果...

            st_astext
------------------------------------------
 POINT(1007193.83859999 257820.786899999)
 POINT(1007209.40620001 257829.435100004)
 POINT(1007244.8654 257833.326199993)
 POINT(1007283.3496 257839.812399998)
 POINT(1007299.3502 257851.488900006)
 POINT(1007320.1081 257869.218500003)
 POINT(1007356.64669999 257891.055800006)
 POINT(1007385.6197 257901.432999998)
 POINT(1007421.94509999 257894.084000006)
 POINT(1007516.85959999 257890.406100005)
 POINT(1007582.59110001 257884.7861)
 POINT(1007639.02150001 257877.217199996)
 POINT(1007701.29170001 257872.893099993)
...

对于纽约的积分,这是非常错误的..我做错了什么?

Hi I'm trying to import a shape file from

http://www.nyc.gov/html/dcp/html/bytes/bytesarchive.shtml

into a postgis database. the above files creates MULTIPOLYGONS when i import using shp2pgsql.

then i'm trying to simply determine if lat/long points are contained in my multipolygons

however my select's are not working, and when i print out the poitns of my the_geom column it seems to be very broken.

select st_astext(geom) from (select (st_dumppoints(the_geom)).* from nybb where borocode =1) foo;

gives the result...

            st_astext
------------------------------------------
 POINT(1007193.83859999 257820.786899999)
 POINT(1007209.40620001 257829.435100004)
 POINT(1007244.8654 257833.326199993)
 POINT(1007283.3496 257839.812399998)
 POINT(1007299.3502 257851.488900006)
 POINT(1007320.1081 257869.218500003)
 POINT(1007356.64669999 257891.055800006)
 POINT(1007385.6197 257901.432999998)
 POINT(1007421.94509999 257894.084000006)
 POINT(1007516.85959999 257890.406100005)
 POINT(1007582.59110001 257884.7861)
 POINT(1007639.02150001 257877.217199996)
 POINT(1007701.29170001 257872.893099993)
...

for points in nyc, this is very off.. what am i doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

木有鱼丸 2024-12-07 17:44:47

点都不是的。所引用的空间数据不是纬度/经度。这就是为什么数字与您的预期不同的原因。如果您需要它是长/纬度,则必须重新投影。在此处查看更多信息:http://postgis.refractions.net/news/20020108/

投影数据似乎位于 NAD_1983_StatePlane_New_York_Long_Island_FIPS_3104_Feet 坐标系(根据元数据 - 请参阅代码。)。

<spref>
    <horizsys>
        <planar>
            <planci>
                <plance Sync="TRUE">coordinate pair</plance>
                <coordrep>
                    <absres Sync="TRUE">0.000000</absres>
                    <ordres Sync="TRUE">0.000000</ordres>
                </coordrep>
                <plandu Sync="TRUE">survey feet</plandu>
            </planci>
            <mapproj><mapprojn Sync="TRUE">Lambert Conformal Conic</mapprojn><lambertc><stdparll Sync="TRUE">40.666667</stdparll><stdparll Sync="TRUE">41.033333</stdparll><longcm Sync="TRUE">-74.000000</longcm><latprjo Sync="TRUE">40.166667</latprjo><feast Sync="TRUE">984250.000000</feast><fnorth Sync="TRUE">0.000000</fnorth></lambertc></mapproj></planar>
        <geodetic>
            <horizdn Sync="TRUE">North American Datum of 1983</horizdn>
            <ellips Sync="TRUE">Geodetic Reference System 80</ellips>
            <semiaxis Sync="TRUE">6378137.000000</semiaxis>
            <denflat Sync="TRUE">298.257222</denflat>
        </geodetic>
        <cordsysn>
            <geogcsn Sync="TRUE">GCS_North_American_1983</geogcsn>
            <projcsn Sync="TRUE">NAD_1983_StatePlane_New_York_Long_Island_FIPS_3104_Feet</projcsn>
        </cordsysn>
    </horizsys>
</spref>

如果您经常使用空间数据,我建议您阅读有关地图投影的更多信息。

The points are not of. The spatial data that is referred to is NOT in lat/long. This is why numbers are different from what you expect. If you need it to be in long/lat it must be reprojected. See more here: http://postgis.refractions.net/news/20020108/

The projection of the data seems to be in the NAD_1983_StatePlane_New_York_Long_Island_FIPS_3104_Feet coordinate system (according to the metadata - see code.).

<spref>
    <horizsys>
        <planar>
            <planci>
                <plance Sync="TRUE">coordinate pair</plance>
                <coordrep>
                    <absres Sync="TRUE">0.000000</absres>
                    <ordres Sync="TRUE">0.000000</ordres>
                </coordrep>
                <plandu Sync="TRUE">survey feet</plandu>
            </planci>
            <mapproj><mapprojn Sync="TRUE">Lambert Conformal Conic</mapprojn><lambertc><stdparll Sync="TRUE">40.666667</stdparll><stdparll Sync="TRUE">41.033333</stdparll><longcm Sync="TRUE">-74.000000</longcm><latprjo Sync="TRUE">40.166667</latprjo><feast Sync="TRUE">984250.000000</feast><fnorth Sync="TRUE">0.000000</fnorth></lambertc></mapproj></planar>
        <geodetic>
            <horizdn Sync="TRUE">North American Datum of 1983</horizdn>
            <ellips Sync="TRUE">Geodetic Reference System 80</ellips>
            <semiaxis Sync="TRUE">6378137.000000</semiaxis>
            <denflat Sync="TRUE">298.257222</denflat>
        </geodetic>
        <cordsysn>
            <geogcsn Sync="TRUE">GCS_North_American_1983</geogcsn>
            <projcsn Sync="TRUE">NAD_1983_StatePlane_New_York_Long_Island_FIPS_3104_Feet</projcsn>
        </cordsysn>
    </horizsys>
</spref>

If you work much with spatial data I suggest that you read more about map projection.

记忆之渊 2024-12-07 17:44:47

我认为这不是 PostGIS 的问题。我使用 AvisMap Free Viewer 检查了输入 esri Shape 文件 nybb.shp 并作为你看到点本身很奇怪:

在此处输入图像描述

但是有一些有趣的东西nybb.shp.xml 元数据文件:

<spdom>
    <bounding>
        <westbc Sync="TRUE">-74.257465</westbc>
        <eastbc Sync="TRUE">-73.699450</eastbc>
        <northbc Sync="TRUE">40.915808</northbc>
        <southbc Sync="TRUE">40.495805</southbc>
    </bounding>
    <lboundng>
        <leftbc Sync="TRUE">913090.770096</leftbc>
        <rightbc Sync="TRUE">1067317.219904</rightbc>
        <bottombc Sync="TRUE">120053.526313</bottombc>
        <topbc Sync="TRUE">272932.050103</topbc>
    </lboundng>
</spdom>

我不熟悉这些工具包(ESRI ArcCatalog),但很可能您需要在使用该元数据导入后重新调整点。

I think this is not issue with PostGIS. I checked input esri Shape file nybb.shp with AvisMap Free Viewer and as you see points are weird itself:

enter image description here

However there is something interesting in nybb.shp.xml metadata file:

<spdom>
    <bounding>
        <westbc Sync="TRUE">-74.257465</westbc>
        <eastbc Sync="TRUE">-73.699450</eastbc>
        <northbc Sync="TRUE">40.915808</northbc>
        <southbc Sync="TRUE">40.495805</southbc>
    </bounding>
    <lboundng>
        <leftbc Sync="TRUE">913090.770096</leftbc>
        <rightbc Sync="TRUE">1067317.219904</rightbc>
        <bottombc Sync="TRUE">120053.526313</bottombc>
        <topbc Sync="TRUE">272932.050103</topbc>
    </lboundng>
</spdom>

I am not familiar with those toolkit (ESRI ArcCatalog), but most probably you need to rescale your points after import using that metadata.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文