您如何知道 shp 文件使用什么 SRID?

发布于 2024-08-07 00:00:06 字数 577 浏览 13 评论 0 原文

我正在尝试将 SHP 文件放入我的 PostGIS 数据库中,但数据有点偏差。我认为这是因为我使用了错误的 SRID。 PRJ 文件的内容如下:

GEOGCS["GCS_North_American_1983",
DATUM["D_North_American_1983",
SPHEROID["GRS_1980",6378137.0,298.257222101]],
PRIMEM["Greenwich",0.0],
UNIT["Degree",0.0174532925199433]]

这与什么 SRID 相关?更一般地说,如何根据 PRJ 文件中找到的信息查找 SRID?是否有一个查找表列出了所有 SRID 及其“geogcs”等效项?

使用 srid=4269 和 4326 导入的数据结果完全相同。

这是否意味着我使用了错误的 SRID,或者这只是预期的误差范围?

shp 文件来自此处

I am trying to put a SHP file into my PostGIS database, the the data is just a little off. I think this is because I am using the wrong SRID. The contents of the PRJ file are as follows:

GEOGCS["GCS_North_American_1983",
DATUM["D_North_American_1983",
SPHEROID["GRS_1980",6378137.0,298.257222101]],
PRIMEM["Greenwich",0.0],
UNIT["Degree",0.0174532925199433]]

What SRID does this correlate to? And more generally, how can I look up the SRID based on the information found in the PRJ file? Is there a lookup table somewhere that lists all SRID's and their 'geogcs' equivalents?

The data imported using srid=4269 and 4326 were the exact same results.

Does this mean I'm using the wrong SRID, or is this just expected margin of error?

The shp file is from here.

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

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

发布评论

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

评论(7

冬天旳寂寞 2024-08-14 00:00:06

详细说明提喻 的答案是,SRID 有时称为“EPSG”代码。 SRID/EPSG 代码实际上是投影的众所周知的文本表示的简写。

您可以在 SRID 表上进行快速搜索,看看是否可以找到完全匹配或相似的匹配:
从spatial_ref_sys中选择srid、srtext、proj4text WHERE srtext ILIKE '%BLAH%'

以上内容位于http://www.bostongis.com/?content_name=postgis_tut01

您还可以在 spatialreference.org 上搜索此类内容。搜索工具很原始,因此您可能必须使用 Google 搜索并指定站点,但任何结果都会向您显示 ESRI PRJ 内容、PostGIS SQL INSERT 和一堆其他表示形式。

我认为您的 PRJ 位于:http://spatialreference.org/ref/sr-org/ 15/

To elaborate on synecdoche's answer, the SRID is sometimes called an "EPSG" code. The SRID/EPSG code is a defacto short-hand for the Well-Known-Text representations of projections.

You can do a quick search on the SRID table to see if you can find an exact or similar match:
SELECT srid, srtext, proj4text FROM spatial_ref_sys WHERE srtext ILIKE '%BLAH%'

Above was found at http://www.bostongis.com/?content_name=postgis_tut01.

You can also search on spatialreference.org for these kinds of things. The search tool is primitive so you may have to use a Google search and specify the site, but any results will show you the ESRI PRJ contents, the PostGIS SQL INSERT, and a bunch of other representations.

I think your PRJ is at: http://spatialreference.org/ref/sr-org/15/

┈┾☆殇 2024-08-14 00:00:06

Prj2EPSG 是一个专门针对这个问题的小网站;粘贴 PRJ 内容,它会尽力找到匹配的 EPSG。他们还有一个网络服务 API。这不是一门精确的科学。他们似乎使用 Lucene 和 EPSG 数据库来进行匹配的文本搜索。

Prj2EPSG is a small website aimed at exactly this problem; paste in the PRJ contents and it does its best to find a matching EPSG. They also have a web service API. It's not an exact science. They seem to use Lucene and the EPSG database to do text searches for matches.

残月升风 2024-08-14 00:00:06

数据似乎是 NAD83,其 SRID 为 4269。您的 PostGIS 数据库有一个 spatial_ref_sys 表,它是 SRID 查找表。

如果 SRID 为 4269 (NAD83) 和 4326 (WGS84) 时数据看起来相同,则说明有问题。

The data seems to be NAD83, which has an SRID of 4269. Your PostGIS database has a spatial_ref_sys table which is the SRID lookup table.

If the data looks the same with an SRID of 4269 (NAD83) and 4326 (WGS84), then there's something wrong.

自找没趣 2024-08-14 00:00:06

去下载 GDAL 实用程序,ogrinfo(它会吐出投影信息)和 ogr2ogr 实用程序非常宝贵。

James 已经给出了 spatialreference.org 的链接。这有助于查找空间参考信息...我假设您在准备好您的 postgis 实例

说实话,我不认为问题出在 PostGIS 方面。

我通常将数据保存在 PostGIS 数据库的不同 SRID 中。但是,我总是需要投影到输出SRS。您正在显示 OpenStreetMap 预渲染图块,我敢打赌它们是使用 SRID 900913 绘制的 (现在每个人都使用 Google 地图修改后的墨卡托投影渲染)。

我给您的建议是:

1- 在 OpenLayers 代码中设置正确的投影,该投影与您正在读取的任何图块相匹配。

2.- 将数据库中的数据保存在您想要的任何 SRID 中(当然只要它是正确的)。

3.- 确保您用来从数据生成图像的服务器(ArcGIS Server、Mapserver、GeoServer 或其他任何服务器)重新投影到同一个 SRS。

一切都会匹配。

干杯

Go and download the GDAL utilities , the ogrinfo (which would spit the projection information) and ogr2ogr utilities are invaluable.

James gave already a link to spatialreference.org. That helps to find spatial reference information... I assume you did load the spatial_ref_sys.sql when you prepared your postgis instance.

And to be honest, I don't think the problem is in the PostGIS side of things.

I usually keep my data in different SRIDs in my PostGIS dbs. However, I always need to project to the output SRS. You are showing OpenStreetMap pre-rendered tiles, and I bet they have been drawn using SRID 900913 (the Google Map's modified mercator projection that now everyone uses to render).

My recommendation to you is:

1- Set the right projection in the OpenLayers code which matches whatever tiles you are reading from.

2.- Keep the data in the database in whatever SRID you want (as long as it is correct of course).

3.- Make sure the server you are using to generate the images from your data (ArcGIS Server, Mapserver, GeoServer or whatever it is) is reprojecting to that same SRS.

Everything will match.

Cheers

握住你手 2024-08-14 00:00:06

使用GDAL的OSR Python模块来确定代码:

from osgeo import osr

srsWkt = '''GEOGCS["GCS_North_American_1983",
DATUM["D_North_American_1983",
SPHEROID["GRS_1980",6378137.0,298.257222101]],
PRIMEM["Greenwich",0.0],
UNIT["Degree",0.0174532925199433]]'''

# Load in the projection WKT
sr = osr.SpatialReference(srsWkt)

# Try to determine the EPSG/SRID code
res = sr.AutoIdentifyEPSG()
if res == 0: # success
    print('SRID=' + sr.GetAuthorityCode(None))
    # SRID=4269
else:
    print('Could not determine SRID')

Use GDAL's OSR Python module to determine the code:

from osgeo import osr

srsWkt = '''GEOGCS["GCS_North_American_1983",
DATUM["D_North_American_1983",
SPHEROID["GRS_1980",6378137.0,298.257222101]],
PRIMEM["Greenwich",0.0],
UNIT["Degree",0.0174532925199433]]'''

# Load in the projection WKT
sr = osr.SpatialReference(srsWkt)

# Try to determine the EPSG/SRID code
res = sr.AutoIdentifyEPSG()
if res == 0: # success
    print('SRID=' + sr.GetAuthorityCode(None))
    # SRID=4269
else:
    print('Could not determine SRID')
疧_╮線 2024-08-14 00:00:06

请务必查看:http://www.epsg-registry.org/

使用按过滤器查询选项并输入:North American Datum 1983。

这将产生 ->每股收益:6269。

希望这对你有用。

Be sure to take a look at: http://www.epsg-registry.org/

Use the Query by Filter option and enter: North American Datum 1983.

This yields -> EPSG:6269.

Hope this works for you.

感悟人生的甜 2024-08-14 00:00:06

其他答案更权威,所以我什至犹豫是否添加这个,但对于一个在使用前应验证的简单建议,可以简单地将“SRID”加上文本粘贴到搜索引擎中,即:

SRID GEOGCS["GCS_North_American_1983", DATUM["D_North_American_1983",
SPHEROID["GRS_1980",6378137.0,298.257222101]],
PRIMEM["格林威治",0.0], UNIT["度",0.0174532925199433]]

当我尝试时,DuckDuckGo 在 EPSG.io 上返回了 SRID 4269 的正确页面作为最佳结果,Bing 和 Google 的表现也几乎一样。

The other answers are more authoritative so I hesitate to even add this, but for a dead-easy suggestion that should be verified before use, one can simply paste "SRID" plus the text into a search engine, i.e.:

SRID GEOGCS["GCS_North_American_1983", DATUM["D_North_American_1983",
SPHEROID["GRS_1980",6378137.0,298.257222101]],
PRIMEM["Greenwich",0.0], UNIT["Degree",0.0174532925199433]]

When I tried it, DuckDuckGo returned the correct page on EPSG.io for SRID 4269 as the top result, and Bing and Google did almost as well.

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