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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
32 views

gdal_rasterize a large geopackage

Trying to run this command with gdal_rasterize: gdal_rasterize --config CHECK_DISK_FREE_SPACE NO -co "PREDICTOR=2" -co "COMPRESS=LZW" -of GTiff -co BIGTIFF=YES -co TILED=YES -co ...
TheRealJimShady's user avatar
1 vote
1 answer
27 views

gdal_rasterize errors

I've got a geopackage which is a set of polygons covering Australia. I am trying to turn them into a raster using gdal_rasterize command. I get errors which I don't know how to solve. The command I ...
TheRealJimShady's user avatar
0 votes
0 answers
38 views

GDAL Rasterize over attribute (rewriting raster issue) in QGIS

I'm trying to process gdal:rasterize_over in QGIS Python console. The same problem persists - this function is rewriting the input sample raster instead of making a new one as output. I've tried (look ...
vkrk's user avatar
  • 11
1 vote
1 answer
144 views

GDAL.Rasterize in Python options not working

I got the following command that works fine: gdal_rasterize -l type -a TOT_P_2018 -tr 1000.0 1000.0 -a_nodata -1.0 -te -2825000.0 -3077000.0 10028000.0 5418000.0 -ot Int32 -of GTiff -co COMPRESS=...
Flash Thunder's user avatar
0 votes
1 answer
808 views

Create binary mask (0, 1) from shapefile using QGIS

I have a TIFF file and a shapefile with polygons. What i would like to achieve is a binary TIFF file with the mask of the polygons indicated as 1's and the surrounding extend of the TIFF file as 0's. ...
Milap's user avatar
  • 25
1 vote
1 answer
88 views

GDAL RasterizeLayer by attribute burns 0 when attribute is null

I am attempting to burn a shapefile onto a raster with an attribute. This works really well generally, but where the shapefile feature has null data for the selected attribute (itype_code in the ...
Matthew Dumont's user avatar
1 vote
2 answers
130 views

Keep a factor field (or a RAT in general) when buffering a raster in R

I am trying to select pixels from a MODIS raster (with a 250 meters resolution and covering all Europe) based on their location. For that I am using a shapefile that contains ca. 200 points (also ...
Carlos Bautista León's user avatar
2 votes
1 answer
137 views

OGR_INTERLEAVED_READING error with gdal_rasterize

I've been trying to rasterize big PBF (1.2GB) file using gdal_rasterize and got this error: ERROR 1: Too many features have accumulated in lines layer. Use the OGR_INTERLEAVED_READING=YES ...
user208190's user avatar
2 votes
1 answer
384 views

Saving gdal_rasterize output to memory in Python script

I have the following Python line to execute GDAL's rasterize function on a shapefile subprocess.call("gdal_rasterize -te {txextent} {tyextent} -tr {resolution} -burn 1 {shapefile} {output_file}....
fuzzy_raster9873's user avatar
0 votes
1 answer
320 views

Is there any way of making gdal_rasterize or gdal_translate create transparent pixels on the output image created?

I'm using the gdal_rasterize to create a TIFF file from a GeoJSON input and gdal_translate to convert the TIFF file to PNG. The code that I'm using is the following: gdal_rasterize -burn 0 -burn 0 -...
raylight's user avatar
  • 1,221
0 votes
1 answer
127 views

How can I use the <src_datasource> parameter from gdal_rasterize?

I'm using the following command to generate a TIFF file from a shapefile: gdal_rasterize -burn 255 -burn 0 -burn 0 -ot Byte -tr 0.0000169959 0.0000169959 -l layer_name input.shp output.tif It works ...
raylight's user avatar
  • 1,221
1 vote
0 answers
105 views

gdal.RasterizeLayer() not outputting a proper geotiff file

I am trying to rasterize a geodataframe of a vector by burning the attribute values onto a template raster. I can't however get my function to output a proper .tiff file. rather it outputs a regular ...
user202796's user avatar
2 votes
0 answers
205 views

Unable to burn attribute values from vector shapefile onto raster using gdal.RasterizeLayer

I am trying to rasterize a shapefile but keep getting errors regarding either my disk space or something about overwriting existing tiff files. The field is an integer in the shapefile. Currently, I'm ...
user202796's user avatar
1 vote
2 answers
481 views

gdal_rasterize using color from feature property

Each feature in my geojson file contains a property with hex color codes. Is it possible to convert these vector feature-collection to a geotiff using this color code on every feature ? I populate the ...
BR75's user avatar
  • 437
3 votes
0 answers
269 views

Rasterize polygon shapefile giving cells average value of overlapping geometries

I want to rasterize a polygon shapefile in r - loaded as an sf. Using stars, I can do st_rasterize to create a stars object snapped to a template raster, which is great because I the next step I want ...
Pablo Herreros Cantis's user avatar
1 vote
0 answers
297 views

Rasterizing in QGIS 3.16 - Rasterlayer doesn't show up

I would like to transfer a vector-layer (containing the attribute "Polygon NN") to a raster. After filling in all parameters and Rasterizing the vector layer, nothing shows up. I watched ...
Pia Rösel's user avatar
4 votes
1 answer
182 views

Rasterize points QGIS average

When I convert points into raster using rasterize (vector to raster) tool, if there are two points in one pixel the pixel takes the bigger one. But I need the pixel to take the average of the values ...
Anas's user avatar
  • 41
2 votes
1 answer
496 views

GDAL - csv to TIFF, struggling with gdal.Rasterize

I am looking to interpolate some dataset via IDW with gdal. I am first trying to create a tiff out of my data to then be able to interpolate it. My code is returning no error however the file created ...
Val's user avatar
  • 23
0 votes
1 answer
47 views

QGIS Raster Statistics For Values Intersecting A Line Feature Vector Layer

Using QGIS 3.16.10 I want to obtain statistics for values in a raster layer that intersect with a line feature shapefile. I have tried using v.rast.stats but generate only 0 values.
Sean Jarrett's user avatar
1 vote
0 answers
212 views

Using Rasterio to create mask from osmnx graph edges creates black .tif

I am using rasterio to create a mask of some .tif with an edge graph that I created with osmnx. I'm assuming that there is something I have to do to the graph to make it work correctly as it works ...
Oliver's user avatar
  • 195
-2 votes
1 answer
143 views

Rasterize point layer error in QGIS [closed]

As advised, I have reprojected the point layer (Project CRS- WGS84 EPSG: 4326) and then trying to rasterize (Vector to raster) the point layer using different combination of pixel and georeferenced ...
Shahnawaz Khan's user avatar
4 votes
1 answer
373 views

Rasterizing only the border of a vector polygon

I have a layer of very 3 x 3 m square polygons. I would like to rasterize just the border of the squares, so the interior cells just have 'nodata' values, and you can see layers below it. When I ...
hmnoidk's user avatar
  • 689
3 votes
0 answers
89 views

Rasterize single polygon-features of a Vectorlayer with Python

What I am trying to do is looping trough the active vector layers features and create for each polygon a rasterfile. My approach is using gdal:rasterize in every iteration, but it wont work at the ...
breezy's user avatar
  • 43
2 votes
1 answer
487 views

Python GDAL RasterizeLayer: Select attribute value in case of shape overlap

I want to rasterize a MultiPolygon Shapefile layer in Python and use values of one column to write to the raster. However, I cannot preclude that features of the Shapefile overlap. Is there a way to ...
Manuel Popp's user avatar
0 votes
1 answer
1k views

gdal.RasterizeLayer can not burn any values or use attribute from shapefile in python

I am trying to rasterize a shapefile but the raster produced by the code it has only 0 as a value. The extends and projection is correct but I am not able to set any value in the raster. I need to use ...
Antonis's user avatar
  • 115
0 votes
0 answers
72 views

Shape ID is lost after converting a shapefile into a raster in QGIS

Instead of a landclass having the value 1 (my previous shapefile ID), the raster classes have the below values after shapefile conversion. The above input values and gdal command was used ...
AQGIS's user avatar
  • 21
0 votes
1 answer
123 views

Sen2Like GDALRasterizeOptions Failed to process SRS definition

While running sen2like tool in single-tile-mode an error related to osgeo gdal occurred (Python): [INFO ] 2021-04-07 13:01:06 - reader - Sentinel2MTL Class [INFO ] 2021-04-07 13:01:06 - reader - ...
Alessandro Saporato's user avatar
2 votes
0 answers
357 views

GDAL rasterizelayer function 's additive rasterizing option (add=True) is not working, what am I doing wrong?

I am trying to rasterize a set of polygons with integer features. Since I am very new using raster data as an initial step I am rasterizing the the polygon centroids first. In the output array I want ...
Ayse Tugba Ozturk's user avatar
4 votes
1 answer
930 views

GDAL Rasterize with "where" option in Python

I've got a shapefile with set of points with a column "test_class" of String type in the attribute table. I need to rasterize these points with setting pixel's value for each class and ...
rybomar's user avatar
  • 43
1 vote
1 answer
1k views

Error in rasterizing a shapefile

I tried to convert a polygon shapefile of classified land cover to raster using 'Rasterize (vector to raster) tool in GDAL. I chose the DN field, set output ratser size unit to pixels and chose the ...
Paris's user avatar
  • 591
1 vote
1 answer
1k views

Rasterize vector data with the extent and resolution of reference raster

I have long tried to rasterize a point shapefile with the same resolution (32.461 km) as another raster layer I have loaded into the QGIS canvas too. I have seen multiple cases, here and here where ...
Thomas's user avatar
  • 875
1 vote
1 answer
567 views

Is there a way to pass an initial value to gdal.RasterizeLayer in Python?

I have tried gdal.RasterizeLayer(..., options=['INIT=1']), but it's ignored. I know that some preferences like options=['ATTRIBUTE={}'.format(att_name)]), or burn_values=[1] can be set, so I thought ...
aliz237's user avatar
  • 33
1 vote
1 answer
464 views

Rasterize function from GDAL in Python has problem with "GetGeoTransform"

I'm trying to rastrize a shapefile that I have. I read the shape using GeoPandas. I would like to give the new raster values based on the shape column called "class" which has numerical ...
ReutKeller's user avatar
  • 2,047
0 votes
1 answer
183 views

Converting CLC local urban atlas vector files to raster

I am try to convert vector files to raster files from the Corine land use data set which provides vector files in their urban atlas. As per: https://land.copernicus.eu/local/urban-atlas For example, I ...
Janusz's user avatar
  • 31
0 votes
2 answers
299 views

Rasterize a shapefile to match an existing raster

I want to work with ecoregions (described in the shapefile from https://ecoregions2017.appspot.com/) in combination with a digital elevation model, to generate a least-cost path. For that purpose, it ...
Anaphory's user avatar
  • 232
1 vote
1 answer
378 views

GDAL_Rasterize, size of file

I'm new to GDAL I try to rasterize a polygon shape file with 'gdal_rasterize' into a tif file. I burn a fix value 1 into the tif file, (-burn parameter) Now my problem: The size of the resulting ...
bluebird1250's user avatar
1 vote
1 answer
275 views

GDAL error in QGIS: "Interpreting GDAL error: "gdal_rasterize: symbol lookup error: gdal_rasterize: undefined symbol: CheckExtensionConsistency"?

I'm using QGIS 3.4.6 with GDAL/OGR 2.3.1 to rasterize a points shapefile with the gdal_rasterize tool, and I keep getting the error 'Interpreting GDAL error: "gdal_rasterize: symbol lookup error: ...
user1521655's user avatar
  • 1,309
0 votes
0 answers
75 views

How large must be my raster for rasterizing a shapefile in R in a scale 1:100.000?

I´m trying to rasterize a shapefile of land cover for the colombian coast. The original shapefile is in a scale of 1:100000. I´m using this code in R language. costa <- readOGR(file.choose()) #...
Cris's user avatar
  • 1
1 vote
0 answers
222 views

Rasterize shp polygons with gdal_rasterize and ALL_TOUCHED - adjacent polygons - select value for burn in

I have a shapefile with streets as polygons, each polygon as an attribute describing its type (for emission modeling). Now I have a highway with an adjacent minor road. When I raster this shapefile ...
sfluck's user avatar
  • 133
0 votes
1 answer
1k views

Converted Vector to Raster file is Black and White in colour (GDAL Rasterize)

def main1(shapefile): #making the shapefile as an object. input_shp = ogr.Open(shapefile) #getting layer information of shapefile. shp_layer = input_shp.GetLayer() #pixel_size ...
Rohit Handique.'s user avatar
1 vote
0 answers
90 views

Vector to Raster conversion doesn't work with Point shapefiles (Python GDAL Library)

def main1(shapefile): #making the shapefile as an object. input_shp = ogr.Open(shapefile) #getting layer information of shapefile. shp_layer = input_shp.GetLayer() #pixel_size ...
Rohit Handique.'s user avatar
3 votes
2 answers
2k views

Generate an empty large raster using GDAL?

Using GDAL, how can I simply create an empty single band raster? I can't seem to find out how. I know in PostGIS you can create a new table with a 'raster' column type, then insert a band into it. ...
Theo F's user avatar
  • 1,787
4 votes
1 answer
631 views

Setting Default Nodata burn value with GDAL Rasterize Layer

I am trying to rasterize a layer as follows: attr = 'N_CT' tif_driver = gdal.GetDriverByName('MEM') raster = tif_driver.Create(path, x_res, y_res, num_bands, gdal.GDT_UInt16) shp_driver = ogr....
Teabubblez's user avatar
1 vote
0 answers
926 views

QGIS Rasterize - Use highest value in cell as burn in value

I am trying to create raster layers of presence/absence bridges in a project area to use as inputs for habitat suitability models. I am using 15 m x 15 m cell size. The presence of bridges is ...
Erica B's user avatar
  • 11
7 votes
2 answers
1k views

Using GDAL tool rasterize with QGIS so that points represent center of grid

I want to convert point data into a grid and used the gdal tool rasterize. The tool works but unfortunately the result looks like this. The converted point does not represent the center of the grid ...
DGIS's user avatar
  • 2,517
2 votes
3 answers
152 views

Describing/creating VRT/CSVT files of variable length space separator for gdal_rasterize command

I have LAS points (DTM) files with space separators. And the problem is for Z coordinate: 360020.678 6245020.453 0.008 ... 364895.678 6245245.453 14.970 ... 364370.678 6246870.453 112.312 ...
Gosha_LT's user avatar
3 votes
1 answer
502 views

gdal_rasterize of shapefile takes days?

I'm trying to rasterize the "Decreasing land productivity" shapefile from https://wad.jrc.ec.europa.eu/geoportal, using: gdal_rasterize -3d -co COMPRESS=DEFLATE -ts 43200 21600 ./lpd_int2.shp ./...
DGentry's user avatar
  • 145
4 votes
2 answers
4k views

How to rasterize individual feature (polygon) from shapefile using GDAL/OGR in Python?

I would like to convert the individual records (polygons/features) of a shapefile to raster using GDAL/OGR. Here is the example shape and the mask raster. Rasterizing the full layer with all records (...
openwater's user avatar
  • 173
5 votes
1 answer
3k views

Using GDAL's Rasterize (Vector to Raster) utility?

I am trying to convert a point layer to a raster file using QGIS python consle. I want the output raster with the extent of a raster file. The new raster should have the point values from the ...
E_123's user avatar
  • 95
5 votes
1 answer
851 views

gdal_rasterize failure with QGIS version 3.6.3

I have both QGIS 3.6.3 and 3.0.1 running on Windows 10 64bit. In 3.6.3 I am unable to rasterise a point layer, while the same operation seems to work in 3.0.1. I'm having to switch between versions ...
NorthernDiver's user avatar