Hot answers tagged

8 votes
Accepted

How to use GDALGridInverseDistanceToAPower in a python script

Yes, you can call this from a Python script. But you don't directly call the low-level C API. First, take a look at the GDAL Grid Tutorial for background info. From the Python library, the relevant ...
Mike T's user avatar
  • 41.8k
5 votes
Accepted

Converting grid corners from UTM to degrees, minutes, and second in QGIS

You can use these expressions: left: to_dms(x_min(transform($geometry,layer_property(@layer,'crs'),'EPSG:4326')),'x',3) top: to_dms(y_max(transform($geometry,layer_property(@layer,'crs'),'EPSG:4326'))...
MrXsquared's user avatar
3 votes
Accepted

Why is GDAL isn't supporting .raw images?

If your "*.raw" images are digital camera raw image files, then you'll need to convert them to a format that GDAL can read using a RAW Editor like Adobe Lightroom (commercial), Darktable (opensource), ...
user2856's user avatar
  • 64.9k
3 votes
Accepted

If degrees is zero, how should Degree Minute Second notation reflect the positive/negative hemisphere?

If possible, stay in decimal degrees and eschew DMS, but sounds like you must. Negative minutes and Negative seconds seems the most appropriate path, placing the negative on the degrees, then the ...
Joseph Kinyon's user avatar
2 votes
Accepted

C-based implementation of Djikstra's or Fast Marching for QGIS/Python?

There are two modules in QGIS Python included: Scipy csgraph: http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.sparse.csgraph.dijkstra.html NetworkX: http://networkx.readthedocs.io/en/...
dmh126's user avatar
  • 6,642
2 votes
Accepted

Getting DEM data programmatically with libgdal?

You are looking for GDALRasterBand::RasterIO. For efficiency, if you are indexing multiple points, you will want to read data in blocks then index into the resulting array
James's user avatar
  • 2,248
2 votes

Print and write the WKB to another shapefile using OGR_G_ExportToWKB in C?

OGRwkbByteOrder (docs on eByteOrder) You are likely wanting to use wkbNDR, which is enum 1, assuming you are running on an intel architecture. invalid conversion error (docs on OGR_G_ExportToWkb()) ...
Logan Byers's user avatar
  • 2,849
2 votes

ReadAsArray() equivalent in C

From the GDAL API tutorial: There are a few ways to read raster data, but the most common is via the GDALRasterBand::RasterIO() method
user2856's user avatar
  • 64.9k
2 votes

How to speed up rasterio.transform.xy

It appears like the authors of rasterio know about the slow conversions and have a WIP branch to address this issue. You could implement xy method yourself as the example in the first link ...
Keith Prussing's user avatar
1 vote
Accepted

GDAL cannot read KML file that it just created

Turns out that GDAL's KML driver will write KML just fine, but will not read KML unless it has been compiled with the Expat library. I only figured this out because I was having a similar problem with ...
Son of a Beach's user avatar
1 vote

RuntimeError: wrapped C/C++ object of type RasterizeStringAlgorithm has been deleted

Open rasterize_string_provider.py file stated in the error Go to line 60 Remove for loop (two lines) for alg in self.alglist: self.addAlgorithm(alg) Add the following lines self.addAlgorithm(...
Kadir Şahbaz's user avatar
1 vote

Clip raster with postgis outputting result in clipping geometry extent

Try this: WITH blade AS ( SELECT ST_MakeEnvelope(0, 0, 4, 4) geom ), butter AS ( SELECT ST_AddBand(ST_MakeEmptyRaster(4, 4, 1, 5, 1), '8BUI'::text, 4) rast ), blade_as_raster AS ( SELECT ...
Pierre Racine's user avatar
1 vote

How to call GEOS error handlers provided during initialization (initGEOS)?

It seems to be GEOSContextHandle_HS::ERROR_MESSAGE(fmt, ...). An example of calling the notice/error functions seems to be in the source code, e.g. for GEOSWKTWriter_destroy: void ...
tinlyx's user avatar
  • 11k
1 vote

Getting GeoTIFF tags with C

After two days of trying to answer this precise question, I finally found the solution of GTIFImageToPCS(). TIFFGetField() is not intended to do this, and GTIFKeyGet() only works on single-field keys.
A.M. Denton's user avatar
1 vote
Accepted

Run-time pointer NULL error in C with OGR

I would guess that the name of the layer getting passed into GDALDatasetGetLayerByName is incorrect. With a shapefile the layer name is the filename without the extension. In this case the layer name ...
Andy C's user avatar
  • 381
1 vote

How to find the minimum perimeter oriented bounding box?

Here is Python Code to determine the MBR by minimum Area. It seems easy to change the criteria to minimum Width or Perimeter. https://github.com/dbworth/minimum-area-bounding-rectangle/blob/master/...
klewis's user avatar
  • 7,455

Only top scored, non community-wiki answers of a minimum length are eligible