1. 主页
  2. 文档
  3. GeoPandas 0.12.2中文文档
  4. User Guide
  5. Managing Projections
  6. Setting a Projection

Setting a Projection

There are two relevant operations for projections: setting a projection and re-projecting.

投影的相关操作有两个:设置投影和重投影。

Setting a projection may be necessary when for some reason geopandas has coordinate data (x-y values), but no information about how those coordinates refer to locations in the real world. Setting a projection is how one tells geopandas how to interpret coordinates. If no CRS is set, geopandas geometry operations will still work, but coordinate transformations will not be possible and exported files may not be interpreted correctly by other software.

当出于某种原因 geopandas 具有坐标数据(x-y 值)但没有关于这些坐标如何指向现实世界中的位置的信息时,可能需要设置投影。设置投影是告诉 geopandas 如何解释坐标的方式。如果未设置 CRS,geopandas 几何操作仍然有效,但坐标转换将无法进行,导出的文件可能无法被其他软件正确解释。

Be aware that most of the time you don’t have to set a projection. Data loaded from a reputable source (using the geopandas.read_file() command) should always include projection information. You can see an objects current CRS through the GeoSeries.crs attribute.

请注意,大多数时候您不必设置投影。从信誉良好的来源加载的数据(使用 geopandas.read_file() 命令)应始终包含投影信息。您可以通过 GeoSeries.crs 属性查看对象当前的 CRS。

From time to time, however, you may get data that does not include a projection. In this situation, you have to set the CRS so geopandas knows how to interpret the coordinates.

然而,有时您可能会得到不包含投影的数据。在这种情况下,您必须设置 CRS,以便 geopandas 知道如何解释坐标。

For example, if you convert a spreadsheet of latitudes and longitudes into a GeoSeries by hand, you would set the projection by passing the WGS84 latitude-longitude CRS to the GeoSeries.set_crs() method (or by setting the GeoSeries.crs attribute):

例如,如果你将一个经纬度电子表格手工转换为GeoSeries,你将通过向GeoSeries.set_crs()方法传递WGS84经纬度CRS来设置投影(或者通过设置GeoSeries.crs属性)。

my_geoseries = my_geoseries.set_crs("EPSG:4326")
my_geoseries = my_geoseries.set_crs(epsg=4326)
标签 , ,
这篇文章对您有用吗?

我们要如何帮助您?

欢迎留下您的宝贵建议

Please enter your comment!
Please enter your name here