解释地理多边形坐标

发布于 2025-01-31 13:02:36 字数 1035 浏览 0 评论 0 原文

Geopandas网站上的此官方示例在这里显示在此显示在此处显示代码>几何列包含 polygon 带有坐标:

               BoroName     Shape_Leng    Shape_Area  \
BoroCode
1             Manhattan  359299.096471  6.364715e+08
2                 Bronx  464392.991824  1.186925e+09
3              Brooklyn  741080.523166  1.937479e+09
4                Queens  896344.047763  3.045213e+09
5         Staten Island  330470.010332  1.623820e+09

                                                   geometry
BoroCode
1         MULTIPOLYGON (((981219.0557861328 188655.31579...
2         MULTIPOLYGON (((1012821.805786133 229228.26458...
3         MULTIPOLYGON (((1021176.479003906 151374.79699...
4         MULTIPOLYGON (((1029606.076599121 156073.81420...
5         MULTIPOLYGON (((970217.0223999023 145643.33221...

我是Geopandas的新手。我认为坐标应遵循GIS的标准。如果是这样,为什么这些坐标如此之大(以百万计)。他们是否以某种方式缩放?如果有人可以解释,谢谢。

This official example on GeoPandas website here displays a sample geopandas dataframe with geometry column containing POLYGON with coordinates:

               BoroName     Shape_Leng    Shape_Area  \
BoroCode
1             Manhattan  359299.096471  6.364715e+08
2                 Bronx  464392.991824  1.186925e+09
3              Brooklyn  741080.523166  1.937479e+09
4                Queens  896344.047763  3.045213e+09
5         Staten Island  330470.010332  1.623820e+09

                                                   geometry
BoroCode
1         MULTIPOLYGON (((981219.0557861328 188655.31579...
2         MULTIPOLYGON (((1012821.805786133 229228.26458...
3         MULTIPOLYGON (((1021176.479003906 151374.79699...
4         MULTIPOLYGON (((1029606.076599121 156073.81420...
5         MULTIPOLYGON (((970217.0223999023 145643.33221...

I am new to GeoPandas. I thought the coordinates should follow GIS standards for GPS. If so, why are these coordinates so large (in millions). Are they scaled up in some way? If someone could explain, thanks.

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

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

发布评论

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

评论(1

归途 2025-02-07 13:02:36

该GeodataFrame具有空间数据,该空间数据被投影到特定的 /a>不是lat/lon。纬度和经度坐标需要对地球形状和参考零点的特定定义 - 最常见的标准是世界大地测量系统1984 (aka wgs84 aka epsg:4326 )。很多时候,当您加载ShapeFile时,数据将使用WGS84编码为LAT/LON。但并非总是如此。

a> geodataframe Geoseries 的属性提供了有关编码数据中使用的特定参考系统的更多信息。在此示例的情况下:

In [3]: nybb_path = geopandas.datasets.get_path('nybb')
   ...: boros = geopandas.read_file(nybb_path)
   ...: boros.set_index('BoroCode', inplace=True)
   ...: boros.sort_index(inplace=True)
   ...: 

In [4]: boros.crs
Out[4]:
<Derived Projected CRS: EPSG:2263>
Name: NAD83 / New York Long Island (ftUS)
Axis Info [cartesian]:
- X[east]: Easting (US survey foot)
- Y[north]: Northing (US survey foot)
Area of Use:
- name: United States (USA) - New York - counties of Bronx; Kings; Nassau; New York; Queens; Richmond; Suffolk.
- bounds: (-74.26, 40.47, -71.8, 41.3)
Coordinate Operation:
- name: SPCS83 New York Long Island zone (US Survey feet)
- method: Lambert Conic Conformal (2SP)
Datum: North American Datum 1983
- Ellipsoid: GRS 1980
- Prime Meridian: Greenwich

您可以看到该数据集中的坐标为 US调查脚的单位引用了North American Datum 1983 (NAD83) (hence the large values), and are projected using a

您可以使用 geopandas.geopandas.geodataframe .to_crs 。 Geopandas使用 pyproj pyproj 预测-WGS84的PROJ语法是“ EPSG:4326”

In [5]: boros_latlon = boros.to_crs('epsg:4326')

In [6]: boros_latlon.crs
Out[6]: 
<Geographic 2D CRS: EPSG:4326>
Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude (degree)
- Lon[east]: Geodetic longitude (degree)
Area of Use:
- name: World.
- bounds: (-180.0, -90.0, 180.0, 90.0)
Datum: World Geodetic System 1984 ensemble
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich

现在,形状表示为lat/lon

In [7]: boros_latlon
Out[7]: 
               BoroName     Shape_Leng    Shape_Area  \
BoroCode                                               
1             Manhattan  359299.096471  6.364715e+08   
2                 Bronx  464392.991824  1.186925e+09   
3              Brooklyn  741080.523166  1.937479e+09   
4                Queens  896344.047763  3.045213e+09   
5         Staten Island  330470.010332  1.623820e+09   

                                                   geometry  
BoroCode                                                     
1         MULTIPOLYGON (((-74.01093 40.68449, -74.01193 ...  
2         MULTIPOLYGON (((-73.89681 40.79581, -73.89694 ...  
3         MULTIPOLYGON (((-73.86706 40.58209, -73.86769 ...  
4         MULTIPOLYGON (((-73.83668 40.59495, -73.83678 ...  
5         MULTIPOLYGON (((-74.05051 40.56642, -74.05047 ... 

参见 geopandas预测指南和坐标参考系统有关更多信息。

This GeoDataFrame has spatial data which is projected onto a specific coordinate reference system (CRS) which is not lat/lon. Latitude and Longitude coordinates need a specific definition of the shape of the earth and reference zero-points - one which is most commonly accepted as the standard is World Geodetic System 1984 (aka WGS84 aka EPSG:4326). Many times, when you load a shapefile, the data will be encoded as lat/lon using WGS84. But not always.

The .crs attribute of a GeoDataFrame or GeoSeries gives more information about the specific reference system used in encoding the data. In the case of this example:

In [3]: nybb_path = geopandas.datasets.get_path('nybb')
   ...: boros = geopandas.read_file(nybb_path)
   ...: boros.set_index('BoroCode', inplace=True)
   ...: boros.sort_index(inplace=True)
   ...: 

In [4]: boros.crs
Out[4]:
<Derived Projected CRS: EPSG:2263>
Name: NAD83 / New York Long Island (ftUS)
Axis Info [cartesian]:
- X[east]: Easting (US survey foot)
- Y[north]: Northing (US survey foot)
Area of Use:
- name: United States (USA) - New York - counties of Bronx; Kings; Nassau; New York; Queens; Richmond; Suffolk.
- bounds: (-74.26, 40.47, -71.8, 41.3)
Coordinate Operation:
- name: SPCS83 New York Long Island zone (US Survey feet)
- method: Lambert Conic Conformal (2SP)
Datum: North American Datum 1983
- Ellipsoid: GRS 1980
- Prime Meridian: Greenwich

You can see that the coordinates in this dataset are in units of US survey feet referenced to the North American Datum 1983 (NAD83) (hence the large values), and are projected using a Lambert Conic Conformal (2SP) projection. This projection has advantages for mapping because, unlike an equi-rectangular projection, e.g. simply mapping lat/lon to pixels, a conformal projection will preserve angles (so e.g. street corners will look like right angles regardless of latitude).

You can change the projection using geopandas.GeoDataFrame.to_crs. GeoPandas uses pyproj to manage projections - the proj syntax for WGS84 is "epsg:4326":

In [5]: boros_latlon = boros.to_crs('epsg:4326')

In [6]: boros_latlon.crs
Out[6]: 
<Geographic 2D CRS: EPSG:4326>
Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude (degree)
- Lon[east]: Geodetic longitude (degree)
Area of Use:
- name: World.
- bounds: (-180.0, -90.0, 180.0, 90.0)
Datum: World Geodetic System 1984 ensemble
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich

Now, the shapes are expressed as lat/lon

In [7]: boros_latlon
Out[7]: 
               BoroName     Shape_Leng    Shape_Area  \
BoroCode                                               
1             Manhattan  359299.096471  6.364715e+08   
2                 Bronx  464392.991824  1.186925e+09   
3              Brooklyn  741080.523166  1.937479e+09   
4                Queens  896344.047763  3.045213e+09   
5         Staten Island  330470.010332  1.623820e+09   

                                                   geometry  
BoroCode                                                     
1         MULTIPOLYGON (((-74.01093 40.68449, -74.01193 ...  
2         MULTIPOLYGON (((-73.89681 40.79581, -73.89694 ...  
3         MULTIPOLYGON (((-73.86706 40.58209, -73.86769 ...  
4         MULTIPOLYGON (((-73.83668 40.59495, -73.83678 ...  
5         MULTIPOLYGON (((-74.05051 40.56642, -74.05047 ... 

See the geopandas guide to projections and coordinate reference systems for more information.

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