简体   繁体   中英

Geopandas' "to_crs" function won't work with Orthographic projection

I am trying to use Geopandas to plot a map of the world in the Orthographic Projection, as shown in TowardsDataScience and tried to use the "to_crs" function with the crs of "EPSG: 9840" which is the EPSG of the Orthographic Projection, but it gives the error message "Invalid projection: EPSG: 9840: (Internal Proj Error: proj_create: crs not found)". Geopandas claims that it supports EPSG codes , but this one doesn't work. Is this just because Geopandas specifically doesn't support this code, or is there something wrong with my code?

I have searched through the websites included in the tutorial and none of the results there worked either.

  • geopandas depends on pyproj for CRS projections. (It is installed when you install geopandas )
  • pyproj installs a database of CRS when installed
  • below works on my system. Have included geopandas and pyproj versions
  • my environment is not at all custom and includes >6500 epsg CRS codes
# EPSG: 9840

import geopandas as gpd
import pyproj

world = gpd.read_file(gpd.datasets.get_path("naturalearth_lowres"))
world = world.loc[world["continent"].eq("Europe")]
world = world.to_crs("epsg:9840")

codes = [crs.code for crs in pyproj.database.query_crs_info(auth_name="EPSG")]
print(f"{pyproj.__version__}, {gpd.__version__}  number of epsg CRS defined:{len(codes)}")

[crs for crs in pyproj.database.query_crs_info(auth_name="EPSG") if crs.code=="9840"]

output

3.3.0, 0.10.2  number of epsg CRS defined:6525

[CRSInfo(auth_name='EPSG', code='9840', name='UCS-2000 / LCS-35 Kirovohrad', type=<PJType.PROJECTED_CRS: 'PROJECTED_CRS'>, deprecated=False, area_of_use=AreaOfUse(west=29.74, south=47.74, east=33.9, north=49.25, name='Ukraine - Kirovohrad region (oblast).'), projection_method_name='Transverse Mercator')]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM