New answers tagged

0

There is a Python code for this on the ArcticDEM page: "Strip DEM files are provided at 2-meter spatial resolution in 32-bit GeoTIFF format. Elevation units are meters and are referenced to the WGS84 ellipsoid. Strip DEM files include metadata text files describing the xyz offsets to filtered IceSAT altimetry data, although these translations have not been ...


0

Is it possible to use other software? I mean CloudCompare. It is free software that will generate geotiff quickly and easily in a few clicks. I made a simple gif with sample asc file:


0

Create the mosaic with gdal_merge (documentation here): gdal_merge.py -o merged.tif raster1.tif raster2.tif raster3.tif ... If the first image (raster1.tif) have a resolution of 0.05m, the mosaic will have a resolution of 0.05m. If not, you can define the pixel size with the -ps parameter. If there are two or more contributing pixels somewhere, the ...


0

Esri ArcGIS can read netCDF files directly. No need to convert to ascii.


5

Those GeoPackages do have spatial indexes ready but there is a small glitch in how the GeoPackage databases are created. That can be seen by reading the contents of the gpkg_geometry_columns table SELECT ROWID, "table_name", "column_name", "geometry_type_name", "srs_id", "z", "m" FROM "gpkg_geometry_columns" ORDER BY ROWID As you can see, all three tables ...


2

Your data is not a regular grid, you have missing points. The XYZ format description specifies "no missing value is supported". Below is an image of a small section of the western edge of the data visualised as points showing the missing values. To convert your data to raster, you can use gdal_grid. gdal_grid doesn't support the full range of OGR open ...


4

Yes, you can write a one bit raster with rasterio*. You need to: write to a format that supports a 1bit dataset, such as GeoTIFF; ensure your numpy array is np.uint8/ubyte so rasterio doesnt raise the TypeError: invalid dtype: 'bool' exception; and pass the NBITS=1 creation option to tell the underlying GDAL GeoTIFF driver to create a one bit file. import ...


4

If you call rasterio.dtypes.check_dtype(np.bool_) you'll see that it's not a known dtype, because gdal doesn't support a true 1-bit dtype. GDT_Byte is the smallest. The list that rasterio is checking against is: dtype_fwd = { 0: None, # GDT_Unknown 1: ubyte, # GDT_Byte 2: uint16, # GDT_UInt16 3: int16, # GDT_Int16 4:...


0

I found a solution for my case: I was using the given "minimum" value -3.40282e+38 from the Layers overview in QGIS. However, using "Raster layer statistics" from the Processing Toolbox in QGIS (3.4.12), is showing more fractional digits: 'MIN': -3.4028234663852886e+38 Using this number to "add additional no data value" via the transparency tab in QGIS ...


1

It should find the osmconf.ini local to the installation. You can override it using -o CONFIG_FILE=<yourpath>/osmconf.ini on the command line. (you might need OSM_CONFIG_FILE instead of CONFIG_FILE) You are probably also going to want to adjust your osmconf.ini to specify what is imported and what ignored. Also, how to handle closed ways,etc. Yes ...


1

You are trying to match two different map projections. The default OpenStreetMap tiles use the EPSG:3857 coordinate reference system, AKA Web Mercator Projection. It looks like this: On the other hand, the Natural Earth files use the EPSG:4326 coordianate reference system, AKA equirectangular projection. It looks like this: The issue of map projections, ...


0

Here's a C# version, ds is a OSGeo.OGR.Driver driver and layerIdX is the layer you want: OSGeo.OGR.Feature feature = null; OSGeo.OGR.Geometry geo = null, ring = null; double[] pointList = { 0, 0, 0 }; int layerIdX = 2; OSGeo.OGR.Layer layer = ds.GetLayerByIndex(layerIdX); if( geoType == "wkbMultiPolygon") { for( int i = 0; i < numberOfFeatures; ...


0

I have been trying the same thing without any luck using the Memory driver. However you can do it using the virtual file system and for instance the Shapefile driver, which means that you are still working on the file in memory and not on disk. You can try replacing drv = ogr.GetDriverByName("Memory") feature_ds = drv.CreateDataSource("memory_name") ...


0

See Python API. Also this code may help you understand how to use gdal.Translate in python: import gdal from gdalconst import GA_ReadOnly def convert_raster_to_LZW_compression(input_raster): basename = os.path.basename(input_raster) basename_without_extention, extention = os.path.splitext(basename) dirname = os.path.dirname(input_raster) ...


0

In python you can use subprocess to call gdal_translate from the command line: import subprocess import os basecmd = "gdal_translate -ot Byte -b 1 -b 2 -b 3 -scale_1 98 854 -scale_2 196 1028 -scale_3 182 1102 -r cubic" indirectory = '/path/to/in/directory' outdirectory = '/path/to/out/directory' infiles = [x for x in os.listdir(indirectory) if x.endswith('....


0

If you are using Travis CI and need a recent version of GDAL for Python, here is an example of what part of a .travis.yml file would look like: language: python env: global: - CPLUS_INCLUDE_PATH=/usr/include/gdal - C_INCLUDE_PATH=/usr/include/gdal before_install: - sudo add-apt-repository -y ppa:ubuntugis/ppa - sudo apt-get -qq update - ...


2

I downloaded the glc_shv10_DOM.Tif and get very different gdalinfo output with Origin = (-180.000000000000000,90.000000001440014) and Pixel Size = (0.008333333333400,-0.008333333333400). You appear to have stripped the georeferencing out of the tif somehow or possibly an issue with your GDAL install. If you just want to tile internally and specify the CRS, ...


0

Through trial and error I have figured out a working solution to this problem. 1) Load the CSV driver manually: var csvDriver = OSGeo.OGR.Ogr.GetDriverByName("CSV"); 2) Open the CSV file using the driver: using (var dataSource = csvDriver.Open(fullColorTableFilePath, 0)) 3) Get the layer from the DataSource. As far as I can tell this is all of the lines ...


0

Two simple solutions with GDAL command line utilities Use the Python script gdal_edit.py https://gdal.org/programs/gdal_edit.html#gdal-edit with option -unsetgt -unsetgt Remove the georeference information. Use gdal_translate utility (also available directly from Python as gdal.Translate, see https://erouault.blogspot.com/2015/10/gdal-and-ogr-utilities-as-...


1

I think I solved my own problem. So its because gdal and filegdb has different version (v3.0.1 vs v2.4.1) and not symlink correctly to /usr/local/lib/gdalplugins/3.0 What I did, change line 4 in osgeo-gdal-filegdb.rb with latest gdal 3.0.1 link from osgeo-gdal.rb in line 23 Then do brew upgrade osgeo-gdal-filegdb


1

Found the issue. Specifically this code: # GetNextFeature handles interleaved reading correctly for ily in range (0,nly): layer = ds.GetLayerByIndex(ily) I initially replaced it with: # GetNextFeature handles interleaved reading correctly for ily in (0,1,2,4,3): layer = ds.GetLayerByIndex(ily) ...which appeared to work. It ensures Layer 4 ("...


1

OK, figured it out (by googling for the opposite!). This issue happens to be trying the opposite (building static only) so gave me a clue. Adding the --disable-static flag when calling ./configure prevents generation of the static libraries, shaving a few minutes off my build time. The build command is now: ./configure --disable-static --prefix=/my/install/...


0

I believe in more recent versions of OSGEO/GDAL module for python one can directly call GDAL utilities from code without involving system calls. for example instead of using subprocess to call : gdalinfo one can call gdal.Info(the_name_of_the_file) to have an exposure of the file metadata/annotation or instead of using subprocess to call: gdalwarp one can ...


1

I'm hesitant to answer this because I've never had the pleasure of working with a GeoPDF, but it's possible to use GDAL/OGR to convert from a GeoPDF to something more sensible. ogr2ogr -f sqlite out.sqlite in.pdf


0

You can use the TiffBitmapDecoder in .NET to open the the GeoTiff and extract metadata in a fairly painless way. I am primarily working with single band elevation GeoTIFF files and the following code represents that, though trimmed down a little. After reading the GeoTIFF in you should have little issue normalizing the values. Using the PixelSize and ...


3

Instead of reprojecting the whole data you may try to set the correct projection for your raster. Similar questions: How to reproject raster from 0 360 to -180 180 with cutting 180 meridian WKT for EPSG:4326 with LON 0 to +360 instead of -180 to +180


0

You can us gdal_calc.py in a for loop. First read all the files name, then use: gdal_calc.py -A input1.tif -B input2.tif --outfile=result.tif --calc="A+B" And then in a loop: gdal_calc.py -A inputX.tif -B result.tif --outfile=result.tif --calc="A+B" Where inputX.tifis the current file you are looping over, so your loop should start at input3 since the ...


1

Gdal_translate can do that with -srcwin https://gdal.org/programs/gdal_translate.html. -srcwin Selects a subwindow from the source image for copying based on pixel/line location. The minimal command would be gdal_translate -srcwin 30 30 1220 900 input.tif output.tif Instead of using gdal_translate binary you can use it also as a library in Python ...


1

In documentation for gdalwarp command: https://gdal.org/programs/gdalwarp.html there is an example where is pointed out that options in your command are precisely used for un-georeferenced images and it is also necessary a cutline as csv file. So, for georeferenced images, you only need to add or to rest 30*(Pixel Size) to xmin ymin xmax ymax values. These ...


0

I would like to create a new raster that contains the sum of all pixelvalues of the raster contained in a folder. Is it possible? os.chdir(r'C:/TifFolder') li_rasters = [raster for raster in os.listdir(os.getcwd()) if os.path.splitext(raster)[-1] == '.tiff'] #print (li_rasters) #final_band=(r'C:/Users/KIFF/Desktop/These/data/Results/result.tiff') for ...


-1

with cmd go to the pip folder, under C:\Python37\Scripts and then pip install gdal


1

Try setting the raster data type - such as gdal.GDT_Float32 dsOut = driver.Create(outFile, g.RasterXSize, g.RasterYSize, 1, gdal.GDT_Float32)


0

i am using an hyperspectral image with 158 bands. I want to calculate raster. but i get import gdal # Import GDAL library bindings from osgeo.gdalnumeric import * from osgeo.gdalconst import * import pylab as plt import numpy as np import xlrd # The file that we shall be using # Needs to be on current directory filename = ('C:/Users/KIFF/Desktop/These/data/...


0

A little late to the discussion, but now there is also ogrmerge ogrmerge.py -single -o merged.shp *.shp -src_layer_field_content {DS_BASENAME}


2

Your 1st step is wrong, as the initial raster is in EPSG:4326 it should be: gdal_translate -a_srs EPSG:4326 -a_ullr -104.7 30.8 -103.8 29.8 MRMS_RALA_LATEST.tiff projected.tiff Then your 2nd step will correctly reproject the raster to epsg:3857 for web mercator.


Top 50 recent answers are included