Questions tagged [rasterization]
The process of turning a vector into its raster equivalent
415
questions
0
votes
0
answers
14
views
ST_AsRaster equivalent function in Python
I have a table in PostgreSQL such as the one below.
fid
name
rating
geometry
osgb43210
Smith Street
1
POLYGON ((507300.52 428808.91, 507299.2 428814.15, 507298.48 428813.98, 507299.37 428808.68, ...
0
votes
1
answer
22
views
Count multilinestring elements crossing a raster cell in R
I have a shapefile with several MULTILINESTRING geometries, representing the borders of some species' distributions, and I want to count the number the number of species occurring in each cell.
I used ...
1
vote
1
answer
35
views
QGIS rasterize does not cover full polygon
When I rasterize my polygon, it does not cover the upper part, as well as a small part in the bottom right. What is the reasoning for this, and how do I change it?
I rasterized the following way:
1
vote
0
answers
22
views
Creating mask layer to clip raster correctly from shapefile in QGIS v3.16.0
Problem:
To create a mask layer to use clip raster by mask layer. I am facing problems with correct creating the mask layer.
I use processing.run('gdal:cliprasterbymasklayer', {'INPUT':f'{gen_path}/{...
0
votes
0
answers
9
views
How to efficiently get the grid id for a given set of points in R?
I am trying to figure out an efficient way to get the grid id for a given set of lat longs. I can do this by rasterizing, but given the size and resolution of my data this takes a long time.
My ...
2
votes
1
answer
25
views
How to find which raster cells are overlapped by polygons
(QGIS 3.22)
I'm trying to compare a raster layer with a vector layer and find all the raster cells overlapped by a vector. Unfortunately, the polygons are much smaller than the pixels of the raster, ...
0
votes
1
answer
31
views
Rasterize a vector layer where pixels just need to include a vector inside, not necessarily on the center
QGIS(3.22) I'm trying to compare a vector layer to a raster layer by rasterizing the layer to the same pixel size as the raster and then using raster calculator. I just want to know which pixels in ...
2
votes
1
answer
73
views
Rasterizing and resampling a vector object using stars::st_rasterize() and terra::rast() loses values/data
I am currently struggling with rasterizing and later, resampling a vector object using functions from stars and terra.
Let's start with the example dataset here: https://drive.google.com/drive/u/2/...
0
votes
1
answer
49
views
Rasterise sf Polygon and Assign Cell Value based on Total Area Deforested
I'm a relatively new to working with spatial data in R.
I'm working with Deforestation data (EPSG: 5880) for the Brazilian Amazon - consisting of 70,000 polygons of deforested land that covers all of ...
1
vote
0
answers
60
views
Method of interpolation to create weighted heatmap rasters in R from point data
I want to create a geospatial heatmap that is weighted by a specific variable sourced from georeferenced points.
An example dataset is 'us_states' from the 'spData' package. I want to take this data, ...
1
vote
1
answer
57
views
Rasterization of polygon with area variable
The usual approach for rasterizing polygons/vectors is to take the values of polygons inside a grid cell and combine them somehow. This works well for field attributes that are not proportional to the ...
0
votes
1
answer
23
views
Managing the drop of information when converting/downsampling from vector to raster (QGIS/GDAL)
I need to rasterize my vector (polygon) data to 10m resolution (to match Sentinel's 10m resolution). But as you can see in the picture, the results are bad for small structures like roads etc. Is ...
1
vote
0
answers
14
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 ...
1
vote
0
answers
51
views
sf multipolygon to elevation raster [closed]
I am trying to create some shadowmaps of the NYC skyline using the shapefiles found here:
shapefiles of NYC buildings.
I can import them after unbundling the gdb folders. What I have trouble with is ...
1
vote
0
answers
27
views
Polygon to Raster is creating a blank surface [closed]
I am attempting to create a raster surface that has values of 1 where my polygons of historical fires are and then 0 for areas of no data. I created a field that just gives every polygon a value of 1 ...
2
votes
0
answers
59
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 ...
1
vote
0
answers
23
views
Rasterizing small polygons error
I'm trying to rasterize a large dataset of polygons to a resolution of 0.5x0.5 degrees. While I don't have problems with large polygons I keep getting rasters full of "0" for the smallest ...
2
votes
1
answer
72
views
QGIS Rasterize tool returning just a flat black box
I got the rasterization to run but it is just giving me a flat black box on top of my point vector data. What does the raster suppose to look like? There is no variation or readability to my data. ...
0
votes
0
answers
57
views
Vector to Raster using QGIS
I have been able to import a csv file into QGIS creating a vector file. I would like to convert the vector file into a raster file. An image of the vector file is shown below.
The structure of the ...
0
votes
1
answer
35
views
Clean DEM in QGIS
I'm attempting to create a DEM in QGIS from contours using the "Rasterize (vector to raster)" function.
How do I create a DEM that is clean and does not have blank spots?
0
votes
0
answers
23
views
Rasterize monthly mesh data
I am working with QGIS and I would like to rasterize mesh data (ERA5 monthly averaged data on temperature) from 1998 to 2018 in order to perform zonal statistics. However, given the huge number of ...
0
votes
1
answer
47
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 ...
2
votes
1
answer
44
views
How to measure flight activity (in vector lines) of a bird within a boundary using raster analysis
I need to find out the time a bird spends in different areas within a windpark.
I have a shapefile (flight lines) with the following attributes:
"presence" is always = 1, the times ...
0
votes
0
answers
33
views
rasterio.features.rasterize doesn't work inside for loop
I'm trying to rasterize GeoPandas dataframe using rasterio.features.rasterize, to rasterize GeoDataframe based on specific column value, as mentioned in this answer.
I want to rasterize by column &...
0
votes
1
answer
96
views
Rasterize GeoPandas with GeoCube into bbox extent
I have GeoPandas dataframe which has one column with code.
id geometry code
0 1 MULTIPOLYGION (((-52.65767 -13.75468, -52.65767... ...
1
vote
0
answers
54
views
QGIS - how to rasterize polygons
From polygons, I would like to create multiple masks or a single multicolor mask as raster (tif) image.
the source data (if imported using geopandas) has the following columns:
zone (values 0, 1, or 2)...
0
votes
0
answers
47
views
Unable to write array to raster file using geocube in python
I have a polygons shapefile with many individual overlapping polygons, each containing a unique value in the "Value" column. I want to iterate over each polygon in this shapefile (feature in ...
0
votes
0
answers
40
views
Unable to rasterize polygons within for loop in Python
I have a shapefile with many polygons, with three separate attribute value columns as "colors": Blue, Red, and Green. For each color, I want to rasterize each individual polygon with that ...
2
votes
1
answer
83
views
N/A data image in rasterizing shapefile with QGIS
I'm trying to rasterize shapefile on QGIS. However, I got blank image whose max and min value are N/A.
Could someone give advice to me?
I took the following two steps.
make field with field ...
1
vote
1
answer
107
views
Assigning new values to a raster based on the mask layer in QGIS
In QGIS, I have two layers: raster and vector (green colored) of the same area of interest. Now, I want to assign "1" to the pixels which lie within the green region, and for the rest assign ...
2
votes
2
answers
190
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-...
1
vote
1
answer
96
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 ...
1
vote
1
answer
157
views
How to rasterize each polygon in shapefile using geocube [python]?
I am trying to take shapefile Boroughs3.shp and rasterize each polygon (row) as its own raster layer, where each new raster would each contain a separate and isolated rasterized polygon. For context, ...
0
votes
1
answer
66
views
Rasterizing polygons in rasterio error: "ValueError: operands could not be broadcast together with shapes"
I am trying to take shapefile Boroughs3.shp and rasterize each polygon (row) as its own raster layer, where each new raster would each contain a separate and isolated rasterized polygon. For context, ...
0
votes
0
answers
106
views
Unable to rasterize polygons in rasterio due to CRSError: EPSG code is unknown
I am trying to take shapefile Boroughs3.shp and rasterize each polygon (row) as its own raster layer, where each new raster would each contain a separate and isolated rasterized polygon. For context, ...
0
votes
0
answers
12
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:...
0
votes
0
answers
28
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 ...
0
votes
1
answer
142
views
Unable to rasterize polygons with rasterio in python (ValueError: Sequences of multi-polygons are not valid arguments)
I am trying to take a polygons shapefile, loop through all the polygons/rows, and rasterize each one, where each raster file output rasterizes its associated polygon as if it were isolated (the only ...
3
votes
1
answer
160
views
Using geocube in Python to rasterize each polygon in shapefile
I have a shapefile of polygons that I brought into Python in Jupyter Notebook via GeoPandas as a geodataframe. There are hundreds of polygons in this shapefile, and I want to create an individual ...
0
votes
0
answers
49
views
GDAL Rasterization not working in QGIS graphical modeler
I have the following graphical modelling command to rasterize a point layer output. However, it gives the following error in the log and doesn't create a raster.
Running Rasterize AEP habitat fuzz [...
0
votes
1
answer
119
views
GDAL Vector to Raster Conversion Not Working
I have a point shapefile that has a field AEP_fuzz and I want to convert to a raster. The field type is double and I get the following error:
GDAL command: gdal_rasterize -l INPUT -a AEP_fuzz -tr 25....
3
votes
2
answers
226
views
Use QGIS to export shapefile as raster to use as mask
I have a shapefile that is a set of polygons. I would like to export it as a black and white image to use as a mask. I'm not incorporating height data (the shapefile only holds 2D data), but encoding ...
1
vote
1
answer
65
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-...
0
votes
0
answers
49
views
How to use GDAL for calculating raster distance?
I am trying to take a shapefile and run individual raster calculations on each polygon using GDAL commands in OSGeo4W Shell.
I have a polygons shapefile, "Polygons.shp", with let's say 250 ...
2
votes
3
answers
553
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-...
0
votes
1
answer
45
views
Problem with Rasterize tool (Vector to Raster)
I am not able to rasterize shp file with Rasterize tool. I keep getting this error :
Could not reproject layer extent: Could not transform bounding box to
target CRS.
I have selected following ...
1
vote
1
answer
34
views
Creating raster layer from vector layer keeping its original symbology colors using ArcMap
I need to get a raster layer from a vector layer using a tool called "Polygon to Raster". My problem is that when I use this tool, the polygon's colors are lost, and the raster obtained is ...
2
votes
1
answer
92
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 ...
0
votes
1
answer
60
views
Calculating species richness of multi polygons by rasterizing them first using R
I have a shapefile of 4 phyla (4 polygons for each class). Each contains multiple species ranges inside it. This means I have data for almost 200 species in these 4 polygon. My data look like this (...
0
votes
0
answers
29
views
Error when attempting to rasterize vector layer in QGIS "ERROR CODE 127"
I am trying to rasterize a vector layer of data, a pretty simple function in QGIS on my MacBook and it is popping up with an error message which I included in the screenshot below. I have had this ...