Skip to main content

All Questions

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

How to use gdal3.js for rasterization

I am trying to use gdal3.js to rasterize GeoJSON to GeoTIFF format in a vanilla JS web app but it is throwing the following error: Uncaught (in promise) TypeError: t.arrayBuffer is not a function ...
Moiyyad sufi's user avatar
2 votes
2 answers
48 views

gdal_rasterize giving different pixel values

I want to count the number of polygons (in this case, protected areas) within a raster cell grid of a specific resolution. To do so, I have tried different approaches in R but, due to the database ...
LT17's user avatar
  • 323
0 votes
2 answers
91 views

Does GDAL rasterize used with polygons use the centre or top left of pixel?

I have found conflicting information on whether GDAL rasterize in practice uses the centre or top left of pixel when converting a set of polygons to a raster. Some posts have documented that the top ...
M C Lisa's user avatar
2 votes
0 answers
37 views

QGIS: Problem to rasterize track

I'm not able to rasterize a GPS plot in QGIS (layer Chemins in red which is interpolation of GPS points) , the output is empty even though it works when I tried with a new simple layer with two line (...
user234137's user avatar
0 votes
1 answer
129 views

How to make multiclass color mask based on polygons (osgeo.gdal python)?

I know how to make binary 1-band mask in python with osgeo.gdal.Rasterize(src, shp_file_name, burnValues=[1]) But what if I have several classes and want to make 3-band mask with different colors for ...
Nikita Artemenko's user avatar
1 vote
2 answers
77 views

Deriving a new raster attribute layer from a polygon layer

I am trying to discern how I can accomplish the following at the command line with GDAL and could use some guidance. I have a GeoTIFF containing data from the National Land Cover Database and I would ...
Chris's user avatar
  • 171
2 votes
2 answers
514 views

Set snap raster in GDAL(C#) rasterize functions

I want to set snap raster for the function rasterize of GDAL, but I can not found. The options parameters are as the following code (C#). What is wrong? rasterizeOptions = new string[] { "...
yixing's user avatar
  • 21
1 vote
0 answers
30 views

Sometimes gdal.RasterizeLayer makes geometry invisible

Honestly I don't know how to explain what's going on correctly but I'll try. I have a table in postgres that I trying to rasterize, and I want to make a separate raster for every feature. Everything ...
Kliver Max's user avatar
  • 2,042
0 votes
1 answer
309 views

Compress output file and set default value when rasterizing ogr layer with GDAL

I am trying to rasterize a polygon layer currently as a feature class in a file geodatabase using OGR/GDAL (Python script). So far I have managed to do the rasterization with the output tif file ...
Pitrako Junior's user avatar
2 votes
3 answers
1k views

Rasterize and sum polygons in Python

I have the following shapefile of NYC with all 5 Boroughs as separate polygons, called Boroughs.shp. Data Source (NYC OpenData): https://data.cityofnewyork.us/City-Government/Borough-Boundaries/tqmj-...
LostinSpatialAnalysis's user avatar
2 votes
1 answer
1k views

Summing all rasters in folder using Python

I have a folder containing many raster files (.tif). I want to sum all of the rasters in this folder into a single output raster using Python in Jupyter Notebook. I have been able to use GDAL command ...
LostinSpatialAnalysis's user avatar
2 votes
1 answer
3k views

How to rasterize polygons using GDAL commands in python?

I have the following polygons shapefile consisting of polygons of the five boroughs of New York City from "NYC Open Data", linked here: https://data.cityofnewyork.us/City-Government/Borough-...
LostinSpatialAnalysis's user avatar
3 votes
4 answers
3k views

Rasterizing polygons in shapefile using GDAL

I have the following polygons shapefile consisting of polygons of the five boroughs of New York City from "NYC Open Data", linked here: https://data.cityofnewyork.us/City-Government/Borough-...
LostinSpatialAnalysis's user avatar
2 votes
1 answer
196 views

Converting GDAL command line statements to Python

I am trying to carry out the task of sending each row/polygon from a single shapefile to its own unique raster. I so far use GDAL commands through the OSGeo4W Shell like so after navigating to my ...
LostinSpatialAnalysis's user avatar
1 vote
0 answers
153 views

Rasterizing vector file in EPSG:4326 using GDAL/OGR in Jupyter notebook

I was trying to rasterize the vector file in Python. I used this code: gdal.Grid("trial2.tif", "merged2018-19.gpkg", zfield="h_li", algorithm="nearest") (the ...
Adyasha Mohapatra's user avatar
0 votes
0 answers
68 views

Trouble with converting polygons (shapefiles) to raster on QGIS

I have a shapefile layer And I wish to convert this to a raster: This layer was geocoded over RADARSAT SAR images, example picture below: I go to Rasterize (Vector to Raster) using GDAL: I input the ...
Sonny Bailey's user avatar
2 votes
1 answer
720 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
2 votes
1 answer
939 views

Anti-aliased rasterization of vectors in QGIS?

I have some polygons that I want to rasterize, but in a fairly low-resolution grid (cell size 250x250m). The raster values of the area inside the polygons should normally have the same value (100), ...
tgerdin's user avatar
  • 63
2 votes
0 answers
414 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
1k 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
967 views

Executing GDALRasterize() function wtih options

I am using GDAL 2.1.0, in both Windows and Linux environments. I want to programmatically rasterize a shapefile in my C++ app. gdal_rasterize I can successfully execute the stand-alone gdal_rasterize ...
Mike Finch's user avatar
1 vote
1 answer
600 views

Burning zeros instead of nodata in GDAL rasterize

When rasterizing a vector layer I would like to achieve an output that contains 1 for areas covered by the shape and 0 for areas not covered. So far GDAL always converts areas that are not covered to ...
joaoal's user avatar
  • 891
0 votes
0 answers
67 views

Rasterize rotated shapefile

I want to rasterize a shapefile (I don't mind whether to use QGIS or python) but I want to rotate my shapefile first and than have my raster aligned to this rotation. So lets say I rotate my shapefile ...
SebSta's user avatar
  • 101
1 vote
0 answers
231 views

Is there a way to rasterize polygon with hatch pattern with GDAL CLI or in a Python script?

I am trying to automate some work previously done in QGIS. Target platform is AWS Lambda so there is no way to use QGIS or any other standalone GIS-specific application. QGIS provide a way to draw ...
walkingpendulum's user avatar
2 votes
1 answer
3k views

How to burn values from a shapefile into raster with gdal.Rasterize?

I have this code to rasterise a point shapefile into raster TIFF. vector_ds = ogr.Open('stations.shp') shp_layer = vector_ds.GetLayer() shape_file = 'stations.shp' output_raster = os.getcwd()+'/...
Nikolay Yasinskiy's user avatar
1 vote
1 answer
223 views

Rasterize doesn't preserves the class attributes original values

I'm using this GDAL based rasterize function in python in order to create raster from shapefile based on numerical class values. I am using: function of GDALMy class attributes are very long numbers : ...
ReutKeller's user avatar
  • 2,215
5 votes
2 answers
838 views

How to choose cell assignment method in GDAL/rasterio rasterize functions?

I have a big (2GB) landcover shapefile I want to convert to a GeoTIFF file. For this purpose, I am using the gdal.Rasterize() function with the following options: rasterize_options = gdal....
Marcelo Villa's user avatar
1 vote
1 answer
2k views

Rasterize polygons using gdal/ogr python API

My understanding so far is that 'gdal' is used for raster data and 'ogr' for vector data. Given this I have been trying to rasterize a polygon data set (output raster metadata is given by a raster ...
Pitrako Junior's user avatar
0 votes
0 answers
928 views

gdal_rasterize multiple attributes to multiple bands

I have a shapefile consisting of polygon geometries, each row/geometry associated with multiple attributes. I want to generate a raster file with multiple bands, where each band will have a different ...
Esra's user avatar
  • 1
1 vote
1 answer
583 views

After converting vector data to raster with GDAL in Python, I get completely black TIFF file

I am trying to convert data from vector to raster with GDAL rasterize using by Python. I want to output raster format as TIFF, but the result TIFF opens completely black. I am writing code benefit ...
emre's user avatar
  • 21
1 vote
0 answers
1k views

Converting Vector (.shp) to Raster (.tiff) using Python GDAL library

I'm trying to convert a vector shapefile to a raster tiff file. I adapted the source code from Python Geospatial Analysis Cookbook by Michael Diener. The code works for line and polygon shapefiles but ...
Rohit Handique.'s user avatar
6 votes
1 answer
343 views

Rasterize/Filter with Burn and Weight variables in QGIS

Using QGIS 3.10.1, I am attempting to rasterize some demographic polygons, and then apply a filter (Gaussian) to create a smooth/graduated surface. This works fine for some of my values (e.g. total ...
David Galt's user avatar
7 votes
2 answers
2k 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,691
2 votes
0 answers
1k views

Rasterize GeoJSON or Shapely Geometry?

I am trying to rasterize a GeoJSON or shapely geometry but it does not rasterize all the geometry (some of it is not in the TIFF-file). I tried gdal_rasterize -burn 255 -burn 0 -burn 0 -ts 4950 4900 ...
EAB's user avatar
  • 31
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
2 votes
0 answers
195 views

Rasterize a geometry using gdal.RasterizeLayer()

I am writing a processing script using QGIS 3.4. I need to rasterize a polygon using gdal.RasterizeLayer. The problem is the polygon is a list of QgsGeometry objects and not a layer. n = (2*radiusInt)...
strythe's user avatar
  • 587
0 votes
0 answers
48 views

Rasterizing a point layer without using an attribute field

I am following the "QGIS by Example" text book and a task requires that a point layer is rasterized using the following GDAL code gdal_rasterize -l layer name -burn 1 -a_nodata 0 -te coordinates - ...
Sean Jarrett's user avatar
0 votes
1 answer
201 views

How to perform shapefile/raster integrated functions

Description: I'm having trouble with some Raster/Shapefile manipulation. My problem is that I have a shapefile that I would like to use to update my rastervalues with. The shapefile has multiple ...
Dr proctor's user avatar
1 vote
0 answers
719 views

Rasterizing shapefile with rasterio and gdal gives all cells 0 values [closed]

I am trying to rasterize my shapefile (20 polygons) with rasterio and fiona and turn the new raster into a mask for clipping. I need to rasterize my all polygons in my shapefile and turn on mask ...
Majda El yacouby's user avatar
2 votes
1 answer
2k 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 ...
Burrow's user avatar
  • 441
0 votes
1 answer
166 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 ...
Davide's user avatar
  • 3
0 votes
1 answer
412 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 ...
Callum Cooper's user avatar
1 vote
1 answer
1k views

Gdal RasterizeLayer Python

I'm attempting to rasterize a layer of a raster by using the different features inside a shapefile(In this case the different features are lines). The problem I am running into is that ...
Francis's user avatar
  • 967
0 votes
0 answers
825 views

Set order of polygons to burn into a raster with GDAL?

I have intersecting polygons with an attribute that I'd like to burn into a raster with GDAL. In this simple example, the attribute Value from three polygons in one shapefile is to be transferred to a ...
user2821's user avatar
  • 398
0 votes
0 answers
288 views

gdal rasterizelayer fails

I have been trying to rasterize a shapefile with polygons in it. At some point it worked but then something changed and I do not know what happened. In the code below (a bit messy, I apologize) I ...
ArnJac's user avatar
  • 375
2 votes
1 answer
477 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....
user109393's user avatar
1 vote
1 answer
421 views

Adding a field with a unique value to vector layer in kml file (need this to burn values with gdal.RasterizeLayer)

I would like to create a field ID in my kml file, with a unique value so that I can use gdal.RasterizeLayer to burn the value to an image like this: gdal.RasterizeLayer(target_ds, [1], source_layer, ...
jlcv's user avatar
  • 345
4 votes
1 answer
863 views

Rasterizing multiple ogr vectors from different files using the GDAL python module?

I'm trying to create a single raster from several shapefiles. I think what I need to do is to merge many layers into a single 'MEM' object. Then re-project this object to a different coordinate system....
Školstvo's user avatar
  • 233
4 votes
3 answers
3k views

Export styled vector layers as TIFF raster?

I have contours that need to go on a TIFF file. They are both georeferenced and in the correct location. I am currently trying to use QGIS to bring them in and change the linetype/lineweight of the ...
Shub's user avatar
  • 942
1 vote
1 answer
2k views

Gdal 2.1.3 Rasterize "kml not recognized as a supported file format"

I am really new to gdal and have a real simple kml file. I tested this kml file in google earth and there was no problem displaying it. But when I try to rasterize it I get the following error: "...
nguvi's user avatar
  • 11