小编Ben*_*ann的帖子

使用 Anaconda 安装 OSMnx

我正在尝试按照此处概述的步骤在我的计算机上安装 Python 3 中的 osmnx 包https://geoffboeing.com/2017/02/python-getting-started/。步骤是:

  1. 下载 miniconda,路径为C:\Anaconda。由于我使用的是大学计算机,因此我无法执行此操作。但是,Anaconda 已安装在这些计算机上,路径为C:\Program Files \Anaconda3.
  2. 在 Anaconda Prompt 中,我尝试了conda update -n base conda。然而,这并没有成功,因为我没有“对目标环境的写权限”( C:\Program Files \Anaconda3)。
  3. 我忽略了这个错误,假设 conda 是最新的。conda config --prepend channels conda-forge跑得很好。
  4. conda create -n ox -c conda-forge osmnx jupyterlabconda activate ox运行良好。OSMnx 和 jupyterlab 在 Anaconda Navigator>Environments>ox>installed 中列出。
  5. 在ox环境下,我运行了jupyter lab,但这给出了以下错误。我对这个巨大的引用感到抱歉,但我不知道如何解释其中的任何一个:
(ox) C:\Users\bm17652>jupyter lab
[I 15:47:48.265 LabApp] Writing notebook server cookie secret to C:\Users\bm17652\AppData\Roaming\jupyter\runtime\notebook_cookie_secret
Traceback (most recent call …
Run Code Online (Sandbox Code Playgroud)

python anaconda conda jupyter osmnx

5
推荐指数
1
解决办法
9913
查看次数

将 Geodataframe 写入 geopandas 中的文件时出现“不支持的驱动程序”错误

我正在读取 GeoJson 文件,对其应用一些函数,然后想要将 GeoDataFrame 保存到另一个文件。

这是我的代码:

import geopandas as gpd
df=gpd.read_file('C:/in_folder/data.json')
df.to_file(driver='C:/out_folder', filename='df.json')
Run Code Online (Sandbox Code Playgroud)

但这会产生以下错误:

DriverError:不支持的驱动程序:'C:/out_folder'

这是回溯:

---------------------------------------------------------------------------
DriverError                               Traceback (most recent call last)
<ipython-input-75-4209247a0f42> in <module>
      1 import geopandas as gpd
      2 df=gpd.read_file('C:/in_folder/data.json')
      3 df.to_file(driver='C:/out_folder', filename='df.json')

~\.conda\envs\ox\lib\site-packages\geopandas\geodataframe.py in to_file(self, filename, driver, schema, **kwargs)
    513         from geopandas.io.file import to_file
    514 
--> 515         to_file(self, filename, driver, schema, **kwargs)
    516 
    517     def to_crs(self, crs=None, epsg=None, inplace=False):

~\.conda\envs\ox\lib\site-packages\geopandas\io\file.py in to_file(df, filename, driver, schema, **kwargs)
    125         schema = infer_schema(df)
    126     with fiona_env():
--> 127 …
Run Code Online (Sandbox Code Playgroud)

python file anaconda geopandas

4
推荐指数
1
解决办法
7152
查看次数

R 中两个几何体对 sf 的几何运算

我有一个带有两个几何列的 sf 数据集。它看起来是这样的:

> trip_geo

   dstid sourceid                    dest_geom                    source_geom
1    1        1   MULTIPOLYGON (((-2.607985 5... MULTIPOLYGON (((-2.607985 5...
2    1        2   MULTIPOLYGON (((-2.607985 5... MULTIPOLYGON (((-2.57022 51...
3    1        3   MULTIPOLYGON (((-2.607985 5... MULTIPOLYGON (((-2.593213 5...
4    1        4   MULTIPOLYGON (((-2.607985 5... MULTIPOLYGON (((-2.608686 5...
5    1        5   MULTIPOLYGON (((-2.607985 5... MULTIPOLYGON (((-2.512852 5...
Run Code Online (Sandbox Code Playgroud)

活动几何是dest_geom

每一行对应于社区之间的一次旅行。对于每次旅行,我都想知道哪些社区妨碍了旅行。也就是说,如果您要在每一行的 source_geom 和 dest_geom 之间画一条直线,哪些几何图形会接触这条直线?我想获得该行所有感人的几何形状,然后将它们合并。

我有另一个数据集,其几何图形对应于每个 id:

> id_geo

   dstid                       geometry
1      1 MULTIPOLYGON (((-2.607985 5...
2      2 MULTIPOLYGON (((-2.57022 51...
3      3 …
Run Code Online (Sandbox Code Playgroud)

geometry r r-sf

1
推荐指数
1
解决办法
1341
查看次数

标签 统计

anaconda ×2

python ×2

conda ×1

file ×1

geometry ×1

geopandas ×1

jupyter ×1

osmnx ×1

r ×1

r-sf ×1