在Windows python中使用 from shapely.geos import lgeos 会报错,错误一般由于调用了依赖**shapely** 库的代码,比如我就是在调用 imgaug中clip_out_of_image AppData\Roaming\Python\Python37\site-packages\shapely\coords.py", line 8, in <module> from shapely.geos import lgeos File "C:\Users\Admin\AppData\Roaming\Python\Python37\site-packages\shapely\geos.py", line 145, in <module> _lgeos = CDLL(os.path.join(sys.prefix, 'Library', 'bin', 'geos_c.dll')) File 解决方案 我们看到里面有一个关于geos_c.dll的文件,而报错的主要原因就出现在geos_c.dll这里,看了网上很多文章大部分说是geos_c.dll文件缺失的原因。
目前GEOS最新的3.7.1版本支持camke进行编译。经过尝试发现通过cmake生成的工程在vs2015下面编译的时候还是存在问题,而且在中文网上也没找到解决方案。 解压出geos-3.7.1文件夹,双击运行其中的autogen.bat。 在目录中找到nmake.opt,这个文件控制着nmake编译的一些参数。 修改好配置之后,找到VS2015的本机工具命令提示符,CD到geos-3.7.1文件夹,输入命令: nmake /f makefile.vc 然后等待编译完成就可以了,最终的输出结果在geos-3.7.1
构建geos、proj 在实现了通用脚本build-common.ps1之后,构建程序就非常容易了,比如构建geos的脚本如下: # geos.ps1 param( [string]$Name = "geos-3.12.2", [string]$SourceDir = ".. 是否强制重新构建 [bool]$Cleanup = $true # 是否在构建完成后删除源码和构建目录 ) # 目标文件 $DllPath = "$InstallDir/bin/geos_c.dll " # 依赖库数组 $Librarys = @() # 符号库文件 $PdbFiles = @( "bin/RelWithDebInfo/geos.pdb", "bin/RelWithDebInfo /geos_c.pdb" ) # 额外构建参数 $CMakeCacheVariables = @{ BUILD_TESTING = "OFF" } . .
目录 1.编译GEOS 2.编译Proj4 3.GDAL集成Proj4和GEOS 1) 修改安装的目录 2) 配置Proj4 3) 配置GEOS 4) 自定义动态库名称(可跳过) 5) 编译 1.编译GEOS 3) 配置GEOS # Uncomment for GEOS support (GEOS >= 3.1.0 required) #GEOS_DIR=C:/warmerda/geos #GEOS_CFLAGS = -I$(GEOS_DIR)/capi -I$(GEOS_DIR)/source/headers -DHAVE_GEOS #GEOS_LIB = $(GEOS_DIR)/source/geos_c_i.lib GEOS_DIR=D:/Work/GDALBuild/geos-3.7.1 GEOS_CFLAGS = -I$(GEOS_DIR)/capi -I$(GEOS_DIR)/include -DHAVE_GEOS ELSE GEOS_LIB = $(GEOS_DIR)/geos_build/x64_release/geos_c_i.lib !
in "C:\geos\trunk" you may create a new folder like "C:\geos\build" enter in "C:\geos\build" and run the command for the compiler you like use: C:\> cd geos\build C:\geos\build> cmake -G "Visual Studio 9 2008" C:\geos\trunk or C:\geos\build> cmake -G "Visual Studio 9 2008 Win64" .. \trunk or C:\geos\build> cmake -G "NMake Makefiles" C:\geos\trunk with these commands cmake creates a /f makefile or C:\geos\build> msbuild GEOS.sln Open Tickets #935 incorrect cmake instruction
gdal-2.2.0+geos-3.4.0+proj-4.8.0 的组合可以解决以上遇到的问题! GEOS 要求 GEOS version >= 3.4.0; export PATH=/Bioinfo/Pipeline/SoftWare/gcc-4.8.5/bin:$PATH wget https: //download.osgeo.org/geos/geos-3.4.0.tar.bz2 tar xvjf geos-3.4.0.tar.bz2 -C .. /build/geos-3.4.0 . =/Bioinfo/Pipeline/SoftWare/geos-3.4.0/bin/geos-config --with-proj-include=/Bioinfo/Pipeline/SoftWare
PostGIS 2.1 准备源码包 准备gdal、proj、geos和postgis的源码包,postgis版本注意和postgresql保持兼容。 、proj、geos和postgis 依次解压、编译、安装以上软件包。 /configure --prefix=/usr/local/proj && make && sudo make install $ tar xf geos-3.3.3.tar.bz2 && cd geos /configure --prefix=/usr/local/geos && make && sudo make install $ tar xf postgis-2.2.6.tar.gz && cd /configure -prefix=/usr/local/postgis --with-geosconfig=/usr/local/geos/bin/geos-config --with-projdir
PostGIS 2.1 准备源码包 准备gdal、proj、geos和postgis的源码包,postgis版本注意和postgresql保持兼容。 、proj、geos和postgis 依次解压、编译、安装以上软件包。 /configure --prefix=/usr/local/proj && make && sudo make install $ tar xf geos-3.3.3.tar.bz2 && cd geos /configure --prefix=/usr/local/geos && make && sudo make install $ tar xf postgis-2.2.6.tar.gz && cd /configure -prefix=/usr/local/postgis --with-geosconfig=/usr/local/geos/bin/geos-config --with-projdir
做个记录 centos+python2.6.6+gdal:2.1.3+proj+geos 1. 检测gcc g++ make 是否存在 2. 安装g++教程http://www.cnblogs.com/myw31415926/archive/2013/03/13/myw31415926.html 3.将gdal2.1.3的包以及proj和geos 从proj到geos到gdal逐个编译 编译教程http://www.it165.net/os/html/201309/6237.html 5.打开到proj目录下 如果configure无法执行 同上编译geos 7.编译gdal 先修改configure和install-sh的权限 再编译 8.如果要配置python的话在./configure步骤时 更改为. /configure结束后 查看geos是不是support了 如果没有就make clean 去把geos重新再编译一遍 然后再来编译gdal 10.gdal编译好了以后 打开gdal>>swig
: 必须: matplotlib 1.0.0 (or later) Python 2.4 (or later, including Python 3) numpy 1.2.1 (or later) GEOS 当在Linux中使用源码安装时,可按以下步骤进行: 1) 安装依赖 2) 解压 basemap.tar.gz 文件,然后 cd 到此文件 3) 安装 GEOS 库。 如果系统中已存在,只需要设置 GEOS_DIR环境变确定 libgeos_c 和 geos_c.h 的位置(如果 libgeos_c 在 /usr/local/lib geos_c.h 在 /usr/ local/include 下, 设置 GEOS_DIR 为 /usr/local)。
relates to the SFCOM ISurface::get_PointOnSurface() method however the current implementation based on GEOS This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail, issuing a CPLE_NotSupported error This function is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this function will always fail, issuing a CPLE_NotSupported
shapely是基于笛卡尔坐标的几何对象操作和分析Python库,底层基于GEOS和JTS库。 也可以通过Canopy和Anaconda等Python发行版工具安装,比如Anaconda,conda install shapely 基于源码 当需要兼容基于GEOS的更多模块,或者想要使用不同的GEOS 版本,可以基于源码进行安装: pip install shapely --no-binaryshapely 如果使用自定义GEOS版本进行安装时,可能需要指定geos-config程序的路径, GEOS_CONFIG = /path/to/geos-config pip install shapely 基本操作 创建点 from shapely.geometry import Point point = Point
编译过程:Win64下编译集成GEOS和Proj4的GDAL。 3) CURL 网络文件传输库,跟在线地图服务相关。同时它也是OpenSceneGraph的第三方依赖库,直接拿过来用就可以了。 4) GEOS GEOS是一个集合形状的拓扑关系操作实用库。osgEarth使用GEOS执行像缓冲和交叉这样的几何操作。虽然它是可选的依赖库,为了使用完整的矢量要素功能,建议加上这个类库。 编译过程:VS2015编译GEOS的debug和release版本。 5) 其他 在官方的编译帮助文档里面还提到了SQLite和QT。
需要安装 shapely库 在pip install shapely 的时候报错 发现没有geos库 先安装VS 2013 然后出现 ? 打开CMD ? 下载 geos库 下载geos-3.5.0,放在d:\geos350中 下载网站:http://trac.osgeo.org/geos/ atuogen.bat nmake /f makefile.vc
cartopy.crs as ccrs import matplotlib.pyplot as plt dat = ds2.metpy.parse_cf('channel_0001_scaled_radiance') geos ) ax.imshow(rgb, origin='upper', extent=(x.min(), x.max(), y.min(), y.max()), transform=geos) # 添加经纬度网格线 ), axis=2).astype('uint8') fig = plt.figure(figsize=(20,12)) ax1 = fig.add_subplot(121, projection=geos ) ax2 = fig.add_subplot(122, projection=geos) # Plot image ax1.imshow(rgb,extent=(X[0], X[-1], Y[-1], Y[0])) ax2.imshow(rgb, origin='upper',extent=(X[0], X[-1], Y[-1], Y[0]), transform=geos) # Add Coastlines
just created. ax.imshow(rgb, origin='upper',extent=(x.min(), x.max(), y.min(), y.max()), transform=geos * 255).astype(np.uint8) 显示局部地区并叠加地图 #获取投影 dat = ds2.metpy.parse_cf('channel_0001_scaled_radiance') geos ), axis=2).astype('uint8') fig = plt.figure(figsize=(20,12)) ax1 = fig.add_subplot(121, projection=geos ) ax2 = fig.add_subplot(122, projection=geos) # Plot image ax1.imshow(rgb,extent=(X[0], X[-1], Y[-1], ) ax2 = fig.add_subplot(122, projection=geos) # Plot image ax1.imshow(rgb,extent=(X[0], X[-1], Y[-1],
3360000.zip C source code as an amalgamation和sqlite-dll-win64-x64-3360000.zip 64-bit DLL (x64) for SQLite geos 源码下载:https://trac.osgeo.org/geos/ TIFF源码下载:https://www.linuxfromscratch.org/blfs/view/stable/general/ ex=BB-1857.0 Sqlite3.3 sqlite3官方网站 sqlite3主要是下载这两个压缩包: GEOS3.8.1 GEOS官方网站 TIFF4.1.0 TIFF官方网站 CURL7.73.0 编译GEOS GEOS的源码目录中有cmakelist.txt文件,因此跟前面编译tiff一样。这里不多BB。 GDAL的编译 GDAL的编译比较复杂。
#获取投影 dat = ds2.metpy.parse_cf('channel_0001_scaled_radiance') geos = dat.metpy.cartopy_crs # We also just created. ax.imshow(rgb, origin='upper',extent=(x.min(), x.max(), y.min(), y.max()), transform=geos fontsize=15) plt.show() 显示局部地区并叠加地图 #获取投影 dat = ds2.metpy.parse_cf('channel_0001_scaled_radiance') geos ), axis=2).astype('uint8') fig = plt.figure(figsize=(20,12)) ax1 = fig.add_subplot(121, projection=geos ) ax2 = fig.add_subplot(122, projection=geos) # Plot image ax1.imshow(rgb,extent=(X[0], X[-1], Y[-1],
as np from cartopy.io.shapereader import Reader import cartopy.feature from cartopy.mpl.patch import geos_to_path as np from cartopy.io.shapereader import Reader import cartopy.feature from cartopy.mpl.patch import geos_to_path as np from cartopy.io.shapereader import Reader import cartopy.feature from cartopy.mpl.patch import geos_to_path as np from cartopy.io.shapereader import Reader import cartopy.feature from cartopy.mpl.patch import geos_to_path \利川市地图\利川.shp') records=shp_data.records() for record in records: path=Path.make_compound_path(*geos_to_path
解决此问题的方法取决于您是使用conda还是pip安装的GDAL、PROJ和GEOS。 下面提供了两种可能的解决方案: 解决方案1:如何您之前使用了conda安装的GDAL、PROJ和GEOS 打开命令提示符或Anaconda Prompt。 确保您已将GDAL相关包卸载执行以下命令: pip uninstall gdal pip uninstall proj pip uninstall geos 然后使用conda重新安装GDAL相关包: