gdal

Can R read grib file(when it is not raster) and convert it to ASCII file?

末鹿安然 提交于 2019-12-02 13:51:55
问题 I am trying to read this grib file but I got an error.is there a way we can solve this problem grib <- readGDAL("C:\\file.grib") Error in .local(.Object, ...) : grib is a grib file, but no raster dataset was successfully identified. 回答1: it is not an R problem. using gdal, I have this : gdalinfo --debug on H14_2011010400.grib GRIB: Undefined parameter table (center 98-0 table 228). GRIB: Undefined parameter table (center 98-0 table 228). GRIB: Undefined parameter table (center 98-0 table 228)

Installation of GDAL with Conda on Windows

僤鯓⒐⒋嵵緔 提交于 2019-12-02 08:07:36
I have Anaconda Python 3.6 on Windows 7. I frequently use GeoPandas and it worked fine. Yesterday I tried to install rasterio and georasters, and they seemed to install fine using the suggested method conda config --add channels conda-forge conda install rasterio Then installed georasters using conda install -c conda-forge georasters And got a successfull installation message. When trying to import them they do not work - there is an error message on import rasterio or import georasters . Digging into it, I found geopandas, fiona and GDAL were now also broken and after 1hr trying uninstalling/

How to open a TIF (CMYK, 16-bit) image file?

。_饼干妹妹 提交于 2019-12-02 08:07:17
I have a script that processes dozens of image files (using Pillow). Recently, I've noticed that my script fails with TIF (CMYK/16) format. So I've created a test case . images = [ "cmyk-8.tif", "cmyk-16.tif", "rgb-8.tif", "rgb-16.tif", ] for img_name in images: path = img_dir + "\\" + img_name try: img = Image.open(path) except OSError as e: print(e) else: print("success: " + img_name) This produces the following output: success: cmyk-8.tif cannot identify image file '...\\cmyk-16.tif' success: rgb-8.tif success: rgb-16.tif So the problem is definitely with the TIF (CMYK/16) format. How can I

How to render custom map tiles created with gdal2tiles in Leaflet for R?

半世苍凉 提交于 2019-12-02 04:46:10
问题 I'm working with the ESA's landcover raster layer and ultimately want to display that data for the globe in a Leaflet Shiny app. Rendering such a massive file is impossible, so I've decided to create map tiles to display the data. Creating the tiles was simple--I used the gdal2tiles tool in QGIS. Here's a quick look of the output, which is in a local directory on my computer: When I click the leaflet.html file , the tiles are rendered in my browser, like so: Obviously the tiles are in working

Python GDAL课程笔记

元气小坏坏 提交于 2019-12-02 02:33:02
说明: 这是一份来自网上的学习笔记,教程来自于犹他州立大学,课程名称为:Geoprocessing with Python using Open Source GIS 。 这份教程在网上有几个网站进行过发布,也无从判断哪份才是原创。作为一份学习笔记,里面很多技术细节都语焉不详,但是不管怎样,这份资料都是很难得的。 开放地理空间实验室进行了整理,修改了一些细节,并进行重新发布。感谢原作者的工作。 地理数据处理软件包GDAL简介 GDAL OGR GDAL python教程(1)——用OGR读写矢量数据 为什么用open source? Open source RS/GIS模块 相关模块 导入库: 读取数据层 释放内存 读完了再说怎么写 GDAL python教程(2)——几何形状geometry与投影projection 建立新的几何形状 创建复合几何形状multi geometry GDAL python教程(3)——过滤器,简单的空间分析,函数和模块 属性过滤器Attribute filters 空间过滤器Spatial filters 统计每种cover类型各有多少个Feature 空间操作 下面看看简单的地理数据处理geoprocessing GDAL python教程(4)——用GDAL读取栅格数据 导入GDAL支持库 GDAL python教程(5)—

Convert NetCDF (.nc) to GEOTIFF

戏子无情 提交于 2019-12-02 01:15:25
I have .nc file sizing around 300MB with a couple of datasets ( TEMP , DEWPOINT ) forecast data. I need to convert ( TEMP ) dataset to multiple GEOTIFF (one .tif for each time slice). Here is how the .nc file looks like. Looked into this answer but it seems to be for the whole dataset. I tried GDAL but not sure how to make it work for each time slice. Any thoughts? netcdf4 -python? gdal has a gdal_translate option that will allow you to do this to translate the file from .nc to .tiff . See below: gdal_translate -of GTiff file.nc test.tiff and using the -b option will allow you to specify which

R: how to write a raster to disk without auxiliary file?

家住魔仙堡 提交于 2019-12-01 20:26:17
问题 I'm writing a dataset to file in ERMapper format (.ers) using the Raster package in R, but I'm having issues with the resulting .aux.xml auxiliary file (which I'm actually not interested in). Simple example: rst <- raster(ncols=15000,nrows=10000) rst[] <- 1.234 writeRaster(rst, filename='_test.ers', overwrite=TRUE) The writeRaster() line takes some time to execute, the data file is quite large, about 1.2GB on disk. When checking what's happening while writeRaster() is executed, I find that

R: how to write a raster to disk without auxiliary file?

佐手、 提交于 2019-12-01 20:14:19
I'm writing a dataset to file in ERMapper format (.ers) using the Raster package in R, but I'm having issues with the resulting .aux.xml auxiliary file (which I'm actually not interested in). Simple example: rst <- raster(ncols=15000,nrows=10000) rst[] <- 1.234 writeRaster(rst, filename='_test.ers', overwrite=TRUE) The writeRaster() line takes some time to execute, the data file is quite large, about 1.2GB on disk. When checking what's happening while writeRaster() is executed, I find that the .ers file (header file + associated data file) is typically generated in about 20 sec. Then, it takes

Launching python subprocess has different behavior depending on launcher

▼魔方 西西 提交于 2019-12-01 19:10:46
I'm attempting to launch Python 2.5 from Python 2.6. The reason for this is a compiled library I'm trying to use (GDAL) isn't supported for the version of Python distributed with another program (ArcGIS). Here's what I'm attempting to do. The main.py file in Python 2.6: import subprocess p = subprocess.Popen(['C:\OSGeo4W\gdal_python_exec.bat', 'X:\\local\\import_tests.py']) gdal_python_exec.bat is a windows batch script that fires up the 2.5 version of Python I want while also setting up some environment variables: @echo off set OSGEO4W_ROOT=C:\OSGeo4W PATH=%OSGEO4W_ROOT%\bin;%PATH% for %%f in

gdal 2.1 Rasterize

笑着哭i 提交于 2019-12-01 18:29:53
Is it possible to set the data type (Byte, Float32) when using gdal.Rasterize in gdal 2.1? Currently, I use gdal.Translate to convert to Byte, but this is inefficient. tif = my/target.tif shp = my/source.shp tiftemp = my/temp/solution.tif rasterizeOptions = gdal.RasterizeOptions(xRes=20, yRes=20, allTouched=True etc.) gdal.Rasterize(tiftemp, shp, options=rasterizeOptions) #translate to Byte data type (not supported by Rasterize?) gdal.Translate(tif, tiftemp, outputType=gdal.GDT_Byte, creationOptions=['COMPRESS=PACKBITS') I am aware that it is possible to use subprocess.check_call('gdal