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
1 vote
0 answers
10 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 ...
user avatar
0 votes
0 answers
19 views

QGIS native:rasterize alg won't create alpha band

I'm running the rasterize tool against a .png tilemap layer. The manual "export raster" option exports a 4 band .tif as expected, including an alpha channel. However, when I implement this ...
user avatar
  • 8,217
0 votes
0 answers
29 views

Generating multi colour raster from KML file using gdal_rasterize

My goal: I am trying to show multiple large KML files (each file > 15 MB) on Google Maps via Google Maps Javascript API. Google Maps doesn't allow large (>10MB) KML files, so I took different ...
user avatar
  • 109
0 votes
1 answer
33 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 -...
user avatar
  • 1,021
0 votes
1 answer
26 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 ...
user avatar
  • 1,021
0 votes
0 answers
61 views

gdal rasterize how to get smooth edges

I'm using gdal_rasterize to convert vector geometries to a geotiff. For the -ts parameter, I pass 50k for width and 40k for height. -ts 50000 40000 The result looks like this: The file size is ...
user avatar
  • 391
1 vote
0 answers
28 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 ...
user avatar
2 votes
0 answers
34 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 ...
user avatar
1 vote
2 answers
90 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 ...
user avatar
  • 391
2 votes
0 answers
71 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 ...
user avatar
1 vote
0 answers
55 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 ...
user avatar
4 votes
1 answer
68 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 ...
user avatar
  • 41
2 votes
1 answer
114 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 ...
user avatar
  • 23
0 votes
0 answers
15 views

Rasterizing line-data with a gradient from the middlemost point

My aim is too rasterize a line data in a way so the middlemost part data is 1 and the outermost pixels are 0 - everything between should be interpolated. The illustration below should showcase my goal:...
user avatar
  • 21
0 votes
0 answers
29 views

Rasterizing line-data with the line-direction as burn in

I am trying to rasterize a line-dataset in a very specific way; namely I want the direction (2D-vector) of the line to be represented as color (RG-vector). The illustration below should hopefully ...
user avatar
  • 21
0 votes
1 answer
23 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.
user avatar
1 vote
0 answers
74 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 ...
user avatar
  • 195
-2 votes
1 answer
83 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 ...
user avatar
0 votes
0 answers
68 views

Convert an OGR File to a Raster in C++

C++ RegisterOGRSXF(); GDALDataset *poDS2 = static_cast<GDALDataset*>( GDALOpenEx( "file.sxf", GDAL_OF_VECTOR, NULL, NULL, NULL )); // file.sxf = any of your files //...
user avatar
  • 1
4 votes
1 answer
206 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 ...
user avatar
  • 575
3 votes
0 answers
73 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 ...
user avatar
  • 43
2 votes
1 answer
178 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 ...
user avatar
0 votes
1 answer
372 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 ...
user avatar
  • 85
0 votes
0 answers
47 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 ...
user avatar
  • 21
0 votes
1 answer
83 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 - ...
user avatar
2 votes
0 answers
154 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 ...
user avatar
4 votes
1 answer
494 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 ...
user avatar
  • 43
1 vote
1 answer
797 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 ...
user avatar
  • 451
1 vote
1 answer
416 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 ...
user avatar
  • 796
1 vote
1 answer
292 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 ...
user avatar
  • 33
1 vote
1 answer
305 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 ...
user avatar
  • 1,817
0 votes
1 answer
102 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 ...
user avatar
  • 31
0 votes
2 answers
196 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 ...
user avatar
  • 162
1 vote
1 answer
221 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 ...
user avatar
1 vote
1 answer
168 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: ...
user avatar
  • 1,269
0 votes
0 answers
31 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()) #...
user avatar
  • 1
1 vote
0 answers
126 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 ...
user avatar
  • 123
0 votes
1 answer
707 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 ...
user avatar
1 vote
0 answers
73 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 ...
user avatar
1 vote
2 answers
1k 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. ...
user avatar
  • 1,365
4 votes
1 answer
412 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....
user avatar
1 vote
0 answers
510 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 ...
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 ...
user avatar
  • 2,317
2 votes
3 answers
80 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 ...
user avatar
3 votes
1 answer
356 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 ./...
user avatar
  • 145
4 votes
2 answers
3k 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 (...
user avatar
  • 163
5 votes
1 answer
2k 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 ...
user avatar
  • 95
5 votes
1 answer
676 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 ...
user avatar
2 votes
0 answers
129 views

How to serve GIS data efficiently and not necessarily using GeoServer or similar?

[I've rewritten this question completely in response to comments] Summary: How to serve GIS data efficiently? I'm looking to serve raster and vector GIS data as a public service, particularly SRTM1 ...
user avatar
1 vote
1 answer
767 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 ...
user avatar