Questions tagged [rasterize]

107 questions
0
votes
0 answers

Convert vector (shape) file to raster (geotiff) using python

I tried several ways and still haven't managed to do it: Using gdal_rasterize: import ogr,gdal output_raster = 'C:\new_raster.tif' input_shp = ogr.Open('C:\input_vector.shp') shp_layer = input_shp.GetLayer() pixel_size = 0.1 xmin, xmax, ymin, ymax…
SNunes
  • 11
  • 2
0
votes
0 answers

python: how to polygon to binary mask with ones in intersection area

Can not make binary mask from self-intersected polygon. import numpy as np from PIL import Image, ImageDraw def show(img,full=False): if full: display(Image.fromarray(np.uint8(img))) else: img = resize(img,300) …
0
votes
1 answer

Rasterize points using the terra package to produce multi-layer SpatRaster

I have some long-standing package code that uses raster::rasterize that I'm trying to update to terra::rasterize. The code takes point data, where each point has one of two possible integer ID values. The output is a raster with two layers, one for…
michael
  • 762
  • 7
  • 13
0
votes
0 answers

How to optimize my drawing routine to rasterize triangles to the screen in Java

I'm currently programming a 3D software renderer where I am rasterizing triangles based on a function to take x and y coordinates to draw 3 lines to draw a triangle that works just fine. However, my code to interpolate through the triangle to fill…
Ryan C.
  • 1
  • 1
0
votes
1 answer

rasterize a shapefile using python

I used following code to rasterize my polygone layer, but it gives the TypeError: in method 'Driver_Create', argument 3 of type 'int' please let me know what is the problem and how I should solve it. import os from osgeo import gdal, ogr, osr import…
user3713988
  • 13
  • 1
  • 7
0
votes
1 answer

terra_rasterize Error: [rasterize] cannot create dataset

I am trying to use the rasterize function in the R package terra (v.1.6-7) to transfer population values associated with municipalities to a raster. I am doing this for two shapefiles, dipomun00gw.shp and municipiosPOP.shp. This is the…
tlaco
  • 3
  • 1
0
votes
1 answer

How can I rasterize a SpatialPolygonsDataFrame so that I can fill a shapefile with points?

I have a chunk of R code that used to work but does not work anymore and I cannot find the issue. The purpose of the code is to fill a shapefile with regularly spaced points. My shapefile can be accessed here:…
Heidi
  • 11
  • 1
0
votes
0 answers

Projection issues after rasterize

I am having issues when plotting SST data after rasterizing the original data file. I eventually want to extract SST from a series of points for each day over a period of time, and so I noticed a shift in the raster relative to coastline after I…
villesci
  • 5
  • 2
0
votes
1 answer

Rasterize lines in R: How to assign max value to a cell?

Problem I want to rasterize spatial lines and assign the maximum value of all lines that touch/intersect a raster cell to that cell. I work in terra with lines as a SpatVect object, I would hence prefer a terra::rasterize solution. I would also be…
chamaoskurumi
  • 2,271
  • 2
  • 23
  • 30
0
votes
1 answer

How to calculate the species richness of multi polygons by rasterizing them first?

I have a shape file of 4 phylum (4 polygons for each class). Each contain multiple species range inside it. Means I have a data of almost 200 species in these 4 polygon. My data look like this (figure attached below). I got this data from IUCN and…
user_3264
  • 107
  • 8
0
votes
1 answer

Problems using rasterize function

I´m pretty new in R so I hope you guys can help me with this step, since I´m pretty stuck. I have a table with monitoring points (coordinates) and a water quality index for each of them. I´m trying to create a raster from this table with the…
0
votes
1 answer

Issue with extracting rows from a Raster* in R

I'm running into an issue working with Raster* objects. I want to extract coordinates from the top and bottom rows of a raster, and use them to then create a new raster with values in only those cells. This is probably a bad explanation, so I'll…
0
votes
1 answer

How to rasterize sf geometries tile by tile?

What I´m looking for is a way to rasterize (or fasterize) geometries within each tile of a certain extent step by step and join the parts of the rasterized geometries to entire raster objects. ## create sample data # create a frame library(sf) ob =…
ilex
  • 103
  • 7
0
votes
1 answer

ActionScript - Rasterize Vector Graphics at Runtime?

i've developed an cross-platform AIR application, which seriously under performs on mobile devices caused by animating/using vector graphics instead of bitmap assets. employing cacheAsBitmapMatrix / cacheAsBitmap is better, when and where assigned…
Chunky Chunk
  • 16,553
  • 15
  • 84
  • 162
0
votes
1 answer

How to specify burn values by attribute using GDAL rasterize (python API)?

I'm using gdal.RasterizeLayer() to convert a shapefile to a GeoTiff using a GeoTiff template while burning the output values by ATTRIBUTE. What I want to output is a .tif where the burn value corresponds to the value of a given attribute. What I…