请指出我遗漏的一点:
openSUSE 11.3
anisha@linux-y3pi:~/Desktop/R> sudo R CMD INSTALL rgdal_0.7-12.tar.gz
root's password:
* installing to library ‘/usr/lib64/R/library’
* installing *source* package ‘rgdal’ ...
** package ‘rgdal’ successfully unpacked and MD5 sums checked
configure: gdal-config: gdal-config
checking gdal-config usability... ./configure: line 1353: gdal-config: command not found
no
Error: gdal-config not found
The gdal-config script distributed with GDAL could not be found.
If you have not installed the GDAL libraries, you can
download the source from http://www.gdal.org/
If you have installed the GDAL …
Run Code Online (Sandbox Code Playgroud) 尝试在UBUNTU虚拟机中安装gdal2.1时,这将是我的命令行序列.我的虚拟机是UBUNTU 16.04 LTS(64位)我需要gdal2.1,特别是Python绑定在python中使用它.当前安装的python版本是2.7.11+,我安装了numpy,因为我知道GDAL是必要的.现在的命令行了
我在GDAL2.1的Pypi页面中找到的说明:
antonio19812@antonio19812-VirtualBox:~$ sudo apt-get install libgdal1i
libgdal1i is already the newest version (1.11.3+dfsg-3build2).
antonio19812@antonio19812-VirtualBox:~$ sudo apt-get install libgdal1-dev
libgdal1-dev is already the newest version (1.11.3+dfsg-3build2).
antonio19812@antonio19812-VirtualBox:~$ sudo pip install gdal
Collecting gdal Downloading GDAL-2.1.0.tar.gz (619kB) 100% |????????????????????????????????| 624kB 247kB/s
Installing collected packages: gdal
Running setup.py install for gdal ... error
Complete output from command /usr/bin/python -u -c "import setuptools,
tokenize;file='/tmp/pip-build-_sHDUY/gdal/setup.py';
exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n',
'\n'), file, 'exec'))" install --record /tmp/pip-eOB65J-record/install-
record.txt --single-version-externally-managed --compile:
running install
running build
running …
Run Code Online (Sandbox Code Playgroud) 在Python中使用GDAL,如何获得GeoTIFF文件的纬度和经度?
GeoTIFF似乎不存储任何坐标信息.相反,它们存储XY原点坐标.但是,XY坐标不提供左上角和左下角的纬度和经度.
看来我需要做一些数学来解决这个问题,但我不知道从哪里开始.
执行此操作需要什么程序?
我知道这个GetGeoTransform()
方法对此很重要,但是,我不知道该怎么做.
我正在研究一些python代码,它使用GDAL(http://www.gdal.org/)及其python绑定从ECW文件中提取一些图像数据.GDAL是从源代码构建的,以获得ECW支持.
该程序在我进入的集群服务器上运行.我已经通过ssh终端测试了程序,运行正常.但是,我现在想使用qsub向集群提交作业,但它报告以下内容:
Traceback (most recent call last):
File "./gdal-test.py", line 5, in <module>
from osgeo import gdal
File "/home/h3/ctargett/.local/lib/python2.6/site-packages/GDAL-1.11.1-py2.6-linux-x86_64.egg/osgeo/__init__.py", line 21, in <module>
_gdal = swig_import_helper()
File "/home/h3/ctargett/.local/lib/python2.6/site-packages/GDAL-1.11.1-py2.6-linux-x86_64.egg/osgeo/__init__.py", line 17, in swig_import_helper
_mod = imp.load_module('_gdal', fp, pathname, description)
ImportError: /mnt/aeropix/prgs/.local/lib/libgdal.so.1: undefined symbol: H5Eset_auto2
Run Code Online (Sandbox Code Playgroud)
我做了一些挖掘,并尝试使用LD_DEBUG=symbols
尝试找出差异的地方,但这就是我的知识/理解带给我的.
作为参考,这里是LD_DEBUG=symbols
在ssh终端中运行和运行代码的事情(通过管道grep H5Eset_auto2
来减少一些输出):
在ssh终端中运行的代码的符号调试输出:
11359: symbol=H5Eset_auto2; lookup in file=/usr/bin/python26 [0]
11359: symbol=H5Eset_auto2; lookup in file=/usr/lib64/libpython2.6.so.1.0 [0]
11359: symbol=H5Eset_auto2; lookup in file=/lib64/libpthread.so.0 [0]
11359: symbol=H5Eset_auto2; lookup in file=/lib64/libdl.so.2 [0]
11359: …
Run Code Online (Sandbox Code Playgroud) 我想在numpy中用NaN替换一个数字,我正在寻找像numpy.nan_to_num这样的函数,反之亦然.
处理不同的数组时,该数字可能会发生变化,因为每个数组都可以唯一定义NoDataValue.我看到人们使用字典,但阵列很大,充满了正面和负面的浮动.我怀疑尝试将所有这些加载到任何东西来创建密钥是没有效率的.
我尝试使用以下和numpy要求我使用any()或all().我意识到我需要迭代元素,但希望内置函数可以实现这一点.
def replaceNoData(scanBlock, NDV):
for n, i in enumerate(array):
if i == NDV:
scanBlock[n] = numpy.nan
Run Code Online (Sandbox Code Playgroud)
NDV是GDAL没有数据值,数组是一个numpy数组.
是一个掩盖阵列的方式可能去?
我有基本的2-D numpy数组,我想将它们"缩减"到更粗糙的分辨率.是否有一个简单的numpy或scipy模块可以轻松地做到这一点?我还应该注意,这个数组是通过Basemap模块在地理上显示的.
样品:
编辑
这是正确的方法,以及文档:
import random
from osgeo import gdal, ogr
RASTERIZE_COLOR_FIELD = "__color__"
def rasterize(pixel_size=25)
# Open the data source
orig_data_source = ogr.Open("test.shp")
# Make a copy of the layer's data source because we'll need to
# modify its attributes table
source_ds = ogr.GetDriverByName("Memory").CopyDataSource(
orig_data_source, "")
source_layer = source_ds.GetLayer(0)
source_srs = source_layer.GetSpatialRef()
x_min, x_max, y_min, y_max = source_layer.GetExtent()
# Create a field in the source layer to hold the features colors
field_def = ogr.FieldDefn(RASTERIZE_COLOR_FIELD, ogr.OFTReal)
source_layer.CreateField(field_def)
source_layer_def = source_layer.GetLayerDefn() …
Run Code Online (Sandbox Code Playgroud) 我想在这个netcdf文件中包装(重新投影)一个变量.
D:\ gdalwarp -t_srs EPSG:4326 NETCDF:"C:\fie.nc":var "C:\Desktop\SM.img"
Run Code Online (Sandbox Code Playgroud)
但我得到这个错误:
错误4:无法打开EPSG支持文件gcs.csv.尝试将GDAL_DATA环境变量设置为指向包含EPSG csv文件的目录.
错误1:翻译源或目标SRS失败:EPSG:4326
我使用的是GDAL 1.9.0,发布于2011/12/29.我将不胜感激任何帮助.
wmap <- readOGR(dsn="~/R/funwithR/data/ne_110m_land", layer="ne_110m_land")
Run Code Online (Sandbox Code Playgroud)
此代码未加载形状文件,并生成错误
Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv, :
Cannot open file
Run Code Online (Sandbox Code Playgroud)
我确信该目录是正确的.最后/也不存在,图层名称也正确.
在ne_110m_land目录文件中我有:
ne_110m_land.dbf
ne_110m_land.prj
ne_110m_land.shp
ne_110m_land.shx
ne_110m_land.VERSION.txt
ne_110m_land.README.html
Run Code Online (Sandbox Code Playgroud) 我正在尝试通过pip安装GDAL.但是我收到了这个错误:
extensions/gdal_wrap.cpp:3089:27: fatal error: cpl_vsi_error.h: No such file or directory
#include "cpl_vsi_error.h"
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Run Code Online (Sandbox Code Playgroud)
我使用了这些命令:
sudo apt-get install libgdal-dev
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
pip install GDAL
Run Code Online (Sandbox Code Playgroud)
谁能告诉我如何安装它?
gdal ×10
python ×6
linux ×3
numpy ×2
r ×2
arrays ×1
geolocation ×1
gis ×1
installation ×1
linker ×1
math ×1
nan ×1
ogr ×1
pip ×1
python-2.6 ×1
rasterizing ×1
rgdal ×1
scipy ×1
tiff ×1
ubuntu-16.04 ×1