python-3.x - 从 ox.projection.project_gdf(city,yerevan.crs) 获取 b'在初始化列表中没有参数'
问题描述
试图获取我正在研究的国家/地区的地图,但得到b'no arguments in initialization list'
错误。代码如下:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import geopandas as gpd
import osmnx as ox
from descartes import PolygonPatch
from shapely.geometry import Point, LineString, Polygon, MultiPolygon
import os
os.environ["PROJ_LIB"] = "C:\\Users\\torre\\Desktop\\Yerevan shapefile\\Yerevan.shp"
import pyproj as project
#Load Yerevan city from openstreetmap using osmnx api
city = ox.gdf_from_place("Yerevan, Armenia",which_result=2)
print(city.crs)
meta = ox.projection.project_gdf(city,yerevan.crs)
#get error of b'no arguments in initialization list' fig, ax = ox.plot_shape(city)
print(city.crs)
解决方案
您没有提供可重现的代码片段,因此您在这里尝试做什么有点不清楚。但是以下用于下载/投影 Yerevan 的可重现代码片段在 OSMnx 的当前版本 (v0.15.1) 中运行良好:
import osmnx as ox
city = ox.geocode_to_gdf('Yerevan, Armenia', which_result=2)
print(city.crs) # prints epsg:4326
city_proj = ox.project_gdf(city, to_crs='epsg:2935')
print(city_proj.crs) # prints epsg:2935
推荐阅读
- typescript - 我的微服务没有监听 Cloudamqp 上的消息
- javascript - 变量不会在第二个客户端窗口中更新
- javascript - 每行 IF 的值减 1
- scala - Scala 3 宏中的显式类型转换
- mysql - 来自 MYSQL 中某个范围的 Entity Framework Core 随机记录
- r - R中的条件概率表
- azure - 如何使用迭代器概念在存储帐户 ARM 模板中添加多个现有虚拟网络和子网?
- c# - 将简单的 lambda 更改为异步 lambda 表达式
- sql - 如果tag的类型是nchar,TDengine不能正确查询数据
- sql-server - 尝试使用 PowerShell 模拟 Excel 中的转换为数字函数