Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [gdal-rasterize]

Burns vector geometries (points, lines, and polygons) into the raster band(s) of a raster image. Vectors are read from OGR supported vector formats.

6
votes
1answer
6k views

Rasterizing shapefiles with GDAL and Python?

I am trying to rasterize a shapefile, and write values from a specific column of the shapefile into the resulting GTiff. Here is what I've done so far, but that only creates a GTiff of zeros. from ...
5
votes
5answers
3k views

How do I create blank geotiff with same spatial properties as existing geotiff?

How do I use gdal to create a blank geotiff with the same spatial properties (size, resolution, extent, projection) as an existing geotiff? (The reason that I want to do this is that I'm using ...
5
votes
2answers
872 views

Create MBTiles from geojson in raster format

I am trying to create raster file in the Mbtiles format. I tried , $ gdal_rasterize -ot Byte -burn 255 -burn 0 -burn 0 -ts 4950 4090 -of MBTiles station.geojson station.mbtiles I'm using, $...
5
votes
2answers
708 views

Get minimum, maximum, average, mean with gdal_rasterize?

I am not 100% sure but it seems like gdal_rasterize takes value of first found feature by default. Is there a way to tell I would like to get minimum / maximum / average / mean (/ count / sum just to ...
4
votes
3answers
5k views

How to convert file .shp to .tif using ogr or python or gdal

I need to convert files. I'm trying to use gdal_rasterize gdal_rasterize -b 1 -burn 0 -l file file.shp work.tif and the output is the following: ERROR 10: Pointer 'hDS' is NULL in '...
4
votes
1answer
820 views

How to set opacity with gdal_rasterize

I am using gdal_rasterize to create a raster of a huge file containing polygons. I managed to generate the raster file with the right color and with the minimum size to tile it after with the ...
4
votes
1answer
396 views

extent parameter pyqgis gdal processing rasterize

I am having trouble with using gdal rasterize under windows in a pyqgis script. The command runs fine under linux without specifying any RAST_EXT parameter. On a windows platform, however, the ...
4
votes
1answer
387 views

How to identify which lines/polygons intersect when using raster data in R

We would like to merge vector and raster data to a common spatial grid. For example, suppose we have a vector file of roads; we'd like to know which roads intersect which cells in the grid. The image ...
3
votes
1answer
345 views

Reversing the order of features in a layer using OGR

I'm working on rasterizing some polygons using gdal_rasterize. This works great, but I want the rasterize command to place features with lower FIDs on top of those with higher FIDs. (Gdal_rasterize ...
3
votes
1answer
806 views

Python and GDAL: NoneType error while reading shapefile

I am a newbie to GDAL. I have a shapefile of Britain which I want to rasterize. This file can be obtained from here selecting United Kingdom as Country and Administrative areas as Subject. Following ...
3
votes
1answer
244 views

Rasterizing vector shapefiles using multiple burn in values

I have a vector shapefile of a geographic area that contains several different object codes that I need to rasterize all as one image. I am working with QGIS, but the Raster>conversion tool seems to ...
3
votes
1answer
312 views

Using signed Bytes with GDAL

In the list of raster pixel data types that are available with GDAL, the "smallest" types are Bytes, UInt16 and Int16. I would like to store integers from 0 to 100 in the smallest image type, but with ...
3
votes
1answer
236 views

How to reproject with gdal_rasterize?

How do I use GDAL tools to rasterise a shapefile, while also reprojecting to a different target coordinate system? The gdal_rasterize documentation says on-the-fly re-projection is supported in ...
2
votes
1answer
965 views

How gdal_rasterize works - how it interpolates / resample values?

I have huge number of points saved as shapefile. I created an empty raster file with low spatial resolution. Next, I applied gdal_rasterize on mentioned .shp and used low resolution raster as ...
2
votes
1answer
667 views

How to use -tap in gdal_rasterize

I have read the gdal documentation for gdal_rasterize. As well as reading the original forum that established -tap (target aligned pixels). I understand -tap is used to make a standard grid (maybe ...
2
votes
1answer
808 views

How to rasterize a point layer with multiple features falling inside a raster cell?

How to make a raster with values that are the sum of all points inside each raster cell? The burn value is a specific attribute. Using gdal_rasterize or gdal.RasterizeLayer(), the resulting raster ...
2
votes
2answers
234 views

Getting max feature value with GDAL Python RasterizeLayer

I'd like to know how to use the Python/GDAL function RasterizeLayer to create a raster layer, where each pixel give the maximum value of a integer attribute. According to docs and forums, if I use : ...
2
votes
1answer
174 views

gdal rasterizelayer constant value

How do you rasterize a polygon layer into a raster so all cells covered by polygons (i.e. not NoData) will be set to a constant value? I do this to set cell according to attribute values: gdal....
2
votes
0answers
128 views

RasterizeLayer in GDAL Java

As per the suggestions given by Michael to one of my earlier query (URL given below), I have tried to develop a sample code to perform rasterize using GDAL Java API methods. I had written based on ...
2
votes
2answers
129 views

How do I assign a unique ID area to an area of a shapefile so I can rasterize it?

I have a shapefile (which can be downloaded from this dropbox link) that I'd like to rasterize so I can merge it with some non-geographic data (I have the code to do this already). Unfortunately, the ...
2
votes
0answers
166 views

Converting to raster using QGIS?

A client of my company has asked us to add a CAD file to a WMS. We have a subcontracted IT company that will adress the WMS part, but we need to provide them with a geoJSON of our client's CAD file. ...
2
votes
1answer
878 views

error “pointer hDs is NULL in GDAL GetProjectionRef” when using gdal_rasterize [duplicate]

I want to convert a .shp to .tif. So I find the tool gdal_rasterize may help. But when I input the file it always meet this error: pointer hDs is NULL in GDAL GetProjectionRef I have tried different ...
1
vote
1answer
65 views

Convert a shapefile with variable values to a raster and distribute the values spatially in each grid cell

I want to convert a shapefile (polygons in WGS84) which contains 3 variables (float values) for each municipality of an area. In fact it contains 1035 municipalities. I want to convert it to a raster ...
1
vote
1answer
188 views

Recommended NoData value for DEM/DTMs created using gdal

Background info: I've been generating some raster DTMs from vector points using gdal_rasterize, and was wondering if there is any consensus as to what is the best NoData value to use. The Python GDAL ...
1
vote
1answer
1k views

How to use gdal_rasterize with postgis vector?

I'm trying to convert a multipolygon vector layer to a raster using the GDAL tool gdal_rasterize. The command I am using is: gdal_rasterize -b 1 -burn -9999 PG:"dbname=db password=password" \ ...
1
vote
1answer
37 views

Rasterize produces wrong result - R

I am trying to rasterize a polygon in R using teh rasterize function but the output is not correct. I am comparing the result with the output produced by the rasterize tool available in QGIS May data ...
1
vote
1answer
186 views

Convert a vector file to an RGB raster using gdal_rasterize without filling polygons

I am trying to convert a vector file that includes polygons to an RGB raster using gdal_rasterize without filling the polygons. Is there a way to do this? For example, I use the following command to ...
1
vote
1answer
613 views

Python: how to set the extent of a raster file based on another raster file (No Arcpy)

What I want to realize is that 1, read a raster file as numpy array; 2, perform Gaussian blur for the array; 3, convert the array to raster file. When I convert the array to the raster file, I ...
1
vote
1answer
501 views

Calculating Distance from Vector Point to Raster Points

I am using QGIS 2.18.2. I would like to calculate the Euclidean distance from the pixels in a raster to a single Shapefile GPS point. My raster is a Geotiff DEM with a pixel size of 3.856 meters by 3....
1
vote
2answers
511 views

Using advanced settings of GDAL_rasterize in QGIS script

I’m working on a script (that later should be used in a processing model) that uses gdal_rasterize to write different attribute values (columns) in different bands of one raster file. I know that ...
1
vote
1answer
57 views

Masking areas outside of polygon using GDAL?

I am trying to "mask" raster cells that are outside of a polygon layer, setting them to "NoData". Also, I need to use GDAL, rather than R which I normally use, because the raster is too large to fit ...
1
vote
0answers
15 views

Result of 'Rasterize' shows only “0” data

I have point shapefile "TAEBAEK". And i want convert it to raster. Rasterize works well. but result show only "0" data. I thought result shows "0" and "1" data. (the cell, containing the point, show ...
1
vote
0answers
81 views

Vector Rasterize Error

I am running QGIS 3.4.4 With GRASS 7.4.4 and I get an error while rasterizing a vector layer and I don't know why. The same error pops up while using GDAL->Rasterize(vector to raster) and while using ...
1
vote
0answers
89 views

Rasterizing Shapefile in different projection/extent from sample raster in Python?

I have a road network shapefile that I'm trying to rasterize and combine with the DEM raster. I created the road network shapefile from a dataset (using fiona) and therefore it has no projection. What ...
1
vote
0answers
537 views

gdal_rasterize: “Attempt to create 0x0 dataset is illegal”

I am new at GIS. I want to burn all polygons from a particular shapefile (i.e. Gbg13004.shp) into a RGB TIFF file (i.e. temp.tiff). I have tried the following command: gdal_rasterize -burn 255 -burn ...
1
vote
1answer
108 views

Problem executing algorithm

When I run the script below, I got this error: rps=10000 #RasterPixelSize layer = iface.activeLayer() extent = layer.extent() xmin = extent.xMinimum() xmax = extent.xMaximum() ymin = extent.yMinimum(...
1
vote
0answers
111 views

Rasterize Function in QGIS 2.18.13 Gives an Error

I just updated QGIS to 2.18.13 and now I'm having trouble using the GDAL [Conversion] function, Rasterize (vector to raster). I have sixteen vectors I made and I want to convert them to rasters. I've ...
1
vote
0answers
80 views

Rasterizing lines significantly slower than polygons

I'm using GSHHG data to create land masks. Rasterizing the original polygons with GDAL_rasterize (via Python) is very quick. However, when I convert the polygons to lines and rasterize that, the ...
1
vote
0answers
305 views

gdal2tile problem geneting tiles

Our problem is that we need to convert a shapefile to raster. Then, we need to generate tiles from zoom 15 to zoom 17 (2millions tiles to 16millions tiles). Before we were using this methodology: ...
1
vote
0answers
82 views

Using gdal_rasterize with a MSSQL Connection, possible?

I'm a bit new to gdal, I mostly use ogr2ogr for data imports to MS SQL Server -- so I'm a bit out of my tree on gdal_rasterize My goal is to create png raster files 200x200 from a geometry column. I ...
0
votes
1answer
1k views

Rasterize a shapefile generate a black TIFF

I run the following codes in jupyter notebook to rasterize the shapefile: building.shp, but it generates a black TIFF, which in QGIS shows only 0 and nan values. Here are the source codes Could ...
0
votes
1answer
528 views

How can I force the blocksize when using gdal_rasterize?

I am rasterizing a shapefile of continents. I use the following command: gdal_rasterize -burn 1 -ts 1440000 560000 -te -180 -60 180 80 -ot Byte -co COMPRESS=PACKBITS -co NUM_THREADS=ALL_CPUS -co ...
0
votes
2answers
1k views

gdal_rasterize is giving no data while converting a shapefile to raster

I have used next command: gdal_rasterize -burn 1 -tr 30 30 fire_2010.shp fireRaster2010.tif to convert shapefile to raster. But I am getting no data in the raster. The same command works for another ...
0
votes
1answer
69 views

gdal RasterizeLayer inverse

I'm triyng to use the python bindings of gdal to rasterize a raster using a shapefile. The code I'm using is rather simple: gdal.RasterizeLayer(target_raster, [1], input_layer ,burn_values=[-9999],...
0
votes
1answer
106 views

gdal_rasterize -te and -tr/-ts options

I'm using gdal_rasterize function to create a raster from my PostGIS database which contains measurements over the entire earth of a gas concentration. (almost 600'000 points over the polygon below) ...
0
votes
1answer
232 views

Polygon rasterization in QGIS 3.2

I want to elevate a certain area of terrain by 126 meters. I've created a polygonal shapefile layer with a decimal field titled "elevation" set to 126. My plan was to rasterize the polygon using GDAL ...
0
votes
0answers
17 views

How to use gdal_rasterize to get the file *.tif?

Good afternoon! Can someone tell me how to properly rasterize isolines with an absolute height value in qgis, when using "gdal_rasterize" in the source code I got tiff with "holes"((
0
votes
0answers
145 views

Why does the output of gdal.RasterizeLayer differ from gdal_rasterize?

Problem I've recently noticed that the output from the gdal.RasterizeLayer function differs from the result I'm getting using the gdal_rasterize utility. I have geotiff of a SAR product that has ...
0
votes
1answer
44 views

Raster from a set of Points keeping the resolution

I have a database with some points covering the earth surface and I want to build a raster (GeoTIFF using gdal_rasterize) which mantains the same spatial resolution of the input points (so without ...
0
votes
0answers
68 views

Sharpmap GeoTIFF placement/scale Issues

I am trying to place GeoTIFFs onto a SharpMap Mapbox. Some GeoTIFFs work just fine and are placed where expected. For example, .tiff files from this website work fine and are placed/scaled ...