Tag Info

Hot answers tagged

4

It looks like GDAL is describing the outer edge of the 'origin pixel' and Arcmap is refering to the center of the origin pixel. If you add half the resolution of a pixel they'll match fine. This definition is often different with different software, it doesnt really matter, though you should know what you're looking at so you can take it into account. One ...


3

You can create a local CRS with an oblique mercator projection, and transform the data with gdalwarp and gdal_translate into it. See my advice here: Using customized Coordinate System for Archaeological site data This should work with 16-bit or grayscale data the same way. Paletted colours shoud be expanded to RGBA in advance. UPDATE Using QGIS, ...


3

Yes, using the SetGeoTransform method. The Geographic Transform defines the origin of the raster in the upper left hand corner, as well as the cell size and the rotation in the x and y direction for the cells in this format: geo_transform = (x top left, x cell size, x rotation, y top left, y rotation, negative y cell size) Or in the example you've ...


3

rt_raster_to_gdal: Could not load the output GDAL driver As for the first error with ST_AsTIFF, you need to enable your GDAL drivers, which by default are not enabled for PostGIS 2.1. See the manual on ways to do this. For instance, I have an environment variable set up on a Windows computer with: POSTGIS_GDAL_ENABLED_DRIVERS=GTiff PNG JPEG GIF XYZ DTED ...


3

You can improve the result with this command line: gdal_translate -of GTiff PARAmap1.pdf out1File.tif --config GDAL_PDF_DPI 300 According to http://www.gdal.org/frmt_pdf.html, the default is 150dpi. For higher quality than 300dpi, you have to be very patient ;-) I was able to extract vector data from USGS topo PDFswith ogr2ogr in Convert GeoPDF with ...


3

You should probably start from http://trac.osgeo.org/gdal/browser/trunk/gdal/alg/polygonize.cpp and follow it and included source files. License is MIT/X license and you can read what it means from the headers.


3

GDAL is not wrong, since there are interior rings ("holes"). Specifically, "DN:4" has two tiny holes: (zoomed in) GeoJSON uses a three-dimension coordinates array to capture multi-ring data. Rings can be exterior or interior (interior rings are the "donut holes" in simple Polygons, and multiple exterior rings are used for island chains, aka ...


2

You can't use GDALFPolygonize with the GDAL python bindings without modifying the source code and recompiling as it isn't exposed in the GDAL swig interface. To polygonize your raster, you will need to convert from float to integer. If you want to retain some decimal places multiply your raster by 10^N where N is the number of decimal places you want to ...


2

The basic syntax is similar to gdal_calc.py i.e. gdal_calculate -a a.tif -b b.tif --calc="a - b" --outfile c.tif If your input rasters are unsigned (i.e Byte or UInt16 etc) and the result may contain negative values, you need to specifically cast to a signed type : gdal_calculate -a a.tif -b b.tif --calc="Int16(a) - b" --outfile c.tif If your rasters ...


2

would add as comment, but a bit long - in case you wanted to use gdal/ogr within python - something like this might work (hacked together from some other code i had - not tested!) This also assumes that rather than finding the nearest raster pixel to a polygon centroid, you simply query the raster at the xy of the centroid. i have no idea what the speed ...


2

This should get you going. The raster values are read using rasterio, and pixel centre coordinates are converted to Eastings/Northings using affine, which are then converted to Latitude/Longitude using pyproj. Most arrays have the same shape as the input raster. import rasterio import numpy as np from affine import Affine from pyproj import Proj, transform ...


2

Rather simple method is to write a new world file (.tfw) which contains rotation parameters. You can make such with OpenOffice Calc, for example. If you have a GeoTIFF file which contains reoreferencing info as stored into the image tag you must clear the geotiff tags and create a baseline tiff to start with. It can be done with gdal_translate: ...


2

Thanks to gdal_translate- why jpg compressed tif is 2 times greater than jpg file?, I found the way : gdal_translate -a_ullr 67.0 37.5 99.0 05.0 \ -co COMPRESS=JPEG -co PHOTOMETRIC=YCBCR \ ./color_hillsades.jpg ./color_hillsades.gis.tif Input is .888MB, output is a .898MB literally just 1% bigger for a georeferenced tif using ...


1

By reading this GDAL ticket http://trac.osgeo.org/gdal/ticket/4977 it should be possible to flip a GeoTIFF by using a negative pixel size in ModelPixelScaleTag. On Y-axis this would mean positive pixel size for GDAL. However, as you can read from the ticket, this trick does not work for you and even if it works you should still place the origin to lower ...


1

I am an old school dgn user - to use a .dgn file in any other program other than microstation - it must first be exported as a .dxf http://www.gdal.org/drv_dxf.html


1

gdal_translate is able to extract single bands: gdal_translate -b 1 in.tif out1.tif gdal_translate -b 2 in.tif out2.tif gdal_translate -b 3 in.tif out3.tif gdal_translate -b 4 in.tif out4.tif Raster -> Conversion -> Translate will create a gdal_translate command line, which you can edit to specify the band you want.


1

I believe that you have done everything right but the neatline is crappy. I checked the first coordinate of the neatline by using the formula for affine transformation from http://www.gdal.org/gdal_datamodel.html Xgeo = GT(0) + Xpixel*GT(1) + Yline*GT(2) Ygeo = GT(3) + Xpixel*GT(4) + Yline*GT(5) The GeoTransform parameters of your image are GT(0)= ...


1

From section 10.13 of R for Mac OS X FAQ: When executing system commands (for example directly via system or indirectly via functions that call other programs such as install.packages) the locations in which the shell is looking for programs is governed by the PATH environment variable. That variable may be set differently for R started from an ...


1

It looks like there are some issues with the path variable, i.e. the shell opened by R doesn't know the path to the gdal binaries. There are two ways to fix this: Specifying the full path You can always use the whole path to gdalinfo in your system call to make it work: path <- "/path/to/gdal/bin/gdalinfo" system2(path, "--version") This may be the ...


1

Turns out in order to read the NEX climate data, I needed very specific versions of the HDF5 and netCDF libraries. I'm not sure which part of the combination was not working for me, since the hours I lost getting it to work was enough time debugging the problem. But I did codify the solution into ansible provisioning scripts. See the 'netcdf' role in the ...


1

I can't say why gdal picks the HDF5 driver with the NEX files on Ubuntu. It shouldn't as the NetCDF driver is tried before the HDF5 driver (the order that drivers are listed in gdalinfo --formats shows the order they are tried). You may not have HDF5 support on your Mac. If you did, you might come across the same issue. To workaround, you could try ...


1

The fourth value is alpha (i.e. RGBA), which you can ignore. The four value structure is expected. You can read the colour tables into native lists/dicts with GDAL. from osgeo import gdal gdal.UseExceptions() ds = gdal.Open(fname) band = ds.GetRasterBand(1) arr = band.ReadAsArray() ct = band.GetColorTable() # index value to RGB (ignore A) i2rgb = ...


1

You can combine the two functions I suppose that the projection of the two shapefiles are the same. 1) spatialRef = inputlyr.GetSpatialRef() gives you the projection of the original shapefile 2) prj = os.path.splitext(outputBufferfn)[0] + ".prj" gives you the name of the prj file of the buffer shapefile outputBufferfn = "a_shapefile.shp" ...


1

On the help page an example is given: gdal_calc.py -A input1.tif -B input2.tif --outfile=result.tif --calc="A+B" This is addition, but subtraction is just as easy: gdal_calc.py -A input1.tif -B input2.tif --outfile=result.tif --calc="A-B"


1

Usually I use the raster calculator manually, in my case for give more weight to one value in a shp or a raster, also for calculate the IRNV in some raster. if you want to automatice some task (in the case of the IRNV) you must use the map algebra toolset instead. Sorry, thats all i know about it [and also sorry for my english :( ]


1

Try using rasterio, which uses GDALFPolygonize on float arrays. import numpy as np import rasterio.features from affine import Affine from shapely.geometry import shape # triangular array ar = np.tri(5, dtype='f') print(ar) for shp, val in rasterio.features.shapes(ar, transform=Affine(1, 0, 0, 0, -1, 5)): print('%s: %s' % (val, shape(shp))) ...


1

The GDAL osm driver makes use of an osmconf.ini file: http://www.gdal.org/drv_osm.html Within that file, you can uncomment the line #other_tags=no to avoid saving all possible names of Sweden in that database column. By the way, GDAL can read the osm.pbf file directly, no need to extract it first.


1

I can't vote up yet so I'm typing my answer, probably some issue with my installation but anyway, reboot worked!



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