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
votes
0answers
32 views

Using gdal_rasterize gives ERROR 1

I'm trying to rasterize a single-band raster, the NDVI from sentinel 2 but I have problems with gdal_rasterize. gdalinfo -proj4 C:\Users\....\....\clip_NDVI.tif gdal_rasterize -a "id" -l myshapefile ...
3
votes
1answer
159 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 (...
0
votes
0answers
28 views

gdal_rasterized failed in terminal

I have this command: gdal_rasterize -l training -a "MC_ID" -ts 3473 4075 -te 42.4132272 -85.3704013 42.41419 -85.3692901 -ot Float32 -of GTiff "training.shp" "training_rasterized2.tif" What I am ...
3
votes
1answer
140 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 ...
1
vote
0answers
83 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 ...
2
votes
0answers
34 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 ...
1
vote
1answer
112 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
19 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
1answer
41 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
0answers
36 views

Getting TIFF with gdal_rasterize

How can I properly rasterize isolines with an absolute height value in QGIS 3? When using "gdal_rasterize" in the source code I got tiff with "holes", see image below
0
votes
1answer
278 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 ...
1
vote
0answers
187 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 ...
0
votes
1answer
112 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],...
1
vote
1answer
80 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
0answers
146 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 ...
2
votes
0answers
192 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 ...
1
vote
1answer
358 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 ...
0
votes
1answer
57 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
138 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 ...
0
votes
1answer
168 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) ...
2
votes
2answers
216 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 ...
3
votes
1answer
404 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 ...
0
votes
1answer
274 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
78 views

Clip raster with shapefile won't work without reprojection (Linux)

So as the title suggests, I am trying to clip an image (UTM) using the OSM land polygon shapefile (WGS 84). I use gdal_rasterize to do that and when I do it on a windows machine it works flawlessly ...
1
vote
1answer
813 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 ...
0
votes
0answers
344 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 ...
1
vote
2answers
2k 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 ...
2
votes
0answers
195 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. ...
1
vote
0answers
737 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
155 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(...
3
votes
1answer
437 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
315 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 ...
5
votes
2answers
1k 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, $...
2
votes
2answers
278 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
208 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....
1
vote
0answers
115 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 ...
0
votes
1answer
778 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 ...
3
votes
1answer
431 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 ...
1
vote
0answers
99 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 ...
0
votes
3answers
2k 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 ...
2
votes
1answer
1k 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 ...
4
votes
1answer
444 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 ...
1
vote
1answer
560 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....
4
votes
1answer
471 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 ...
1
vote
2answers
598 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 ...
3
votes
3answers
7k 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 '...
5
votes
5answers
4k 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 ...
2
votes
1answer
952 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 ...
5
votes
1answer
8k 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 ...
2
votes
1answer
1k 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 ...