# Tag Info

16

Convert your stream vectors to raster with a value of 1 and the same extent and cellsize as your DEM. In the Raster Calculator use a map algebra expression something along the lines of: Con("rivers"==1, "DEM" - 1, "DEM") If you want to burn in the streams more than 1 elevation unit, change "DEM" - 1 to "DEM" - a bigger value. To implement the Whitebox ...

10

Whitebox GAT (open-source hydrology and remote sensing package) has a method by this name in its Hydrology utilities. Whitebox is unique in that it exposes the source code and algorithms used by the analysis via the UI (note the View Code button). Even if you intend to isolate your procedures to ArcGIS, there may be some benefits to experimenting with ...

8

Since you also have a QGIS tag how about a GDAL solution? Within QGIS: Via the menubar select ---> Raster > Conversion > Rasterize (raster to vector) Then set your attribute and check the output. Rasterize whole map within QGIS: Go File -> Save as image, then choose tif. (unfortunately this does not work for map composer) Via the command line using ...

7

You could use gdal_rasterize either from the command line or QGIS to generate your raster. To make sure your points sit within a cell, you need to do two things. First, set the target resolution to 5m, and set the extents to be 2.5m bigger all around than the source data. So, assuming your dataset goes from [1000 2000] [2500 3250], giving you your 75,000 ...

6

If your data contains xyz data (where z is the raster value) and your points are on a regular grid (no need for interpolation). library("raster") r <- rasterFromXYZ(as.data.frame(travel)[, c("x", "y", "z")]) If you need interpolation, you can use akima library : library("raster") library("akima") steps <- 100 isu <- with(travel@data, interp(x, ...

6

OK so a second attempt to answer your question with a pure GDAL solution. Firstly, GDAL (Geospatial Data Abstraction Library) was originally just a library for working with raster geo-spatial data, while the separate OGR library was intended to work with vector data. However, the two libraries are now partially merged, and are generally downloaded and ...

5

If you want to get zonal statistics for several features in one shapefile, you have to loop over the zonal_stats function. You can write the results of the loop for example to a dictionary. Below is the modified zonal_stats function together with a loop, looping over the input shapefile. As an output you get a Dictionary containing for each Feature ID the ...

5

I've been playing with GDALRasterizeLayers this week and have a pretty good idea of what it is doing. By default, it will rasterise a pixel if the pixel centre is within the polygon. If there is nothing in the centre, it won't be rasterised, even if there are parts of a polygon within the pixel limits. To allow the rasterising to work the way you intend, try ...

5

In addition to @Etiennebr's answer, I'd go for an apply style loop (which is more R-ish, and uses less code for the same thing): library("raster") filenames <- list.files(path="", pattern="XYhectareTravelTimes_ez+.*shp") raster_cat = lapply(filenames, function(x) { travel <- as.data.frame(readShapePoints(x)) r <- rasterFromXYZ(travel[, c("x", ...

5

I've had some luck reading from and writing to layers. Specifically, I have code that will read a shapefile layer containing polylines and output the geometry of each feature to text files (used as input for an old model). name = layer.name() provider = layer.dataProvider() feat = QgsFeature() # Now we can loop through all the defined features ...

5

Following a recent question, you may want to make use of the functionalities offered by the rgeos package to solve your problem. For reasons of reproducibility, I downloaded a shapefile of Tanzanian roads from DIVA-GIS and put it in my current working directory. For the upcoming tasks, you will need three packages: rgdal for general spatial data handling ...

5

I think that your issue is only a "Zoom In" problem. I'm going to render to tif these random points with Raster-> Conversion -> Rasterize (Vector to Raster) Tool (cell resolution 30 x 30) of QGIS; equivalent to your standalone Python script. Loaded raster layer looks as if no point had been rasterized. However, with point layer as first layer, 'Zoom In'...

4

Go Raster -> Conversion -> Rasterize. Set a vector layer to process, a field with values and desired raster size.

4

Two things you could check: First make sure that your resolution is set correctly. This you do with the "Edit Current Grass Region" button. You mentioned that the original csv file had points every 40 km. If you want to stay with that, then assuming your points are in a projected coordinate system you should set the resolution to 40,000. If the points are ...

4

On the file menu go to export. There you will select the jpg format and down below on the options tab you select the write world file.

4

You could try to create a Voronoi diagram. It seems to work: If the Voronoi tool should fail on 75,000 points, try divide&conquer: Split the point layer into multiple smaller ones to make computation easier.

4

This is a kludge but it does work - haven't found a way to go directly from points to raster yet (but am hoping someone gives a solution here!). Starting with a point grid (random points in the Serengeti from the Vector|Research tools|Random points tool): Create a polygonal grid of the same extent and cell size as the raster you'd like to have (this from ...

4

These two comparable tools exist because ESRI has multiple license levels. Point to Raster (Conversion) is only available with the Advanced license. Feature to Raster (Conversion) is available with all of the license levels. Point to Raster allows you much more control over how multiple points are handled when multiple points fall within a raster cell. ...

4

Feature to raster will convert lines, points or polygon features to rasters, while polygon to raster will only convert polygons. http://resources.arcgis.com/en/help/main/10.2/index.html#//00120000002v000000 http://resources.arcgis.com/en/help/main/10.2/index.html#//001200000030000000 They both can handle polygons, which is why they are completing what you ...

4

I cannot recover your error but it seems that the parameters b=... l=... for band and layer are not present and I don't know what is in your data field a=class_raster, may be it is not a numeric type that fits into the raster band, that you want to fill with these data or NA could also be a problem. Here a little how to, I use to test the gdal_raster in GNU-...

3

With multiprocessing, for fastness! Has a little different output-formatting. #!/usr/bin/python import gdal, ogr, osr, numpy, sys from multiprocessing import Pool # Raster dataset input_value_raster = sys.argv[1] # Vector dataset(zones) input_zone_polygon = sys.argv[2] # Open data rast = gdal.Open(input_value_raster) shp = ogr.Open(input_zone_polygon) #...

3

I've not tried it, but GDAL's gdal_rasterize should do the trick with its -3d option: gdal_rasterize -3d -tr 10.0 10.0 -l streams streams.shp streams.tif

3

According to the GDAL Proximity page: -distunits PIXEL/GEO: Indicate whether distances generated should be in pixel or georeferenced coordinates (default PIXEL). So you can specify the distances in pixels or in the unit of the coordinates you used to georeference the raster.

3

You have arcgis as one of your tags so I will answer from that perspective. The tool for converting shapefile features into raster is Feature To Raster. Alternatively, you may want to consider Exporting your map using one of the supported raster formats.

3

The below is modified from Jeffrey Evans' solution. This solution is much faster as it does not use rasterize library(raster) library(rgdal) library(rgeos) roads <- shapefile("TZA_roads.shp") roads <- spTransform(roads, CRS("+proj=utm +zone=37 +south +datum=WGS84")) rs <- raster(extent(roads), crs=projection(roads)) rs[] <- 1:ncell(rs) # ...

3

This can be done in a two step process... Use Merge to combine all your polygons into one polygon (tool found in the Data Management / General toolbox) Use Feature to Raster to change the polygon into a raster (tool found in the Conversion / To Raster toolbox). These are both straightforward tools. The most complicated part with Feature to Raster is ...

3

Here's a simple reproducible example. I give 2 approaches, one using mosaic/merge and another that just does the initial rasterize at the total extent of all shapefiles combined. The results are the same. Added based on Jeffrey Evans comment: You also need to consider what to do when you have overlapping polygons. If you want to apply a function (e.g. sum, ...

3

As you figured out, the column is not defined as 'Integer' or 'Real' type. You can use Field Calculator to add a new column of type integer and write an expression such as below to have a field you can use in conversion. toint("TEXTURA LA")

3

I found the error. In one crucial part of the code a set (unordered collection) was used instead of a list (ordered collection).

2

Your error says as.integer(putvals). The R rasterize function can't work on Strings. You have to transform your data first. Something like this may work, but i would assign different ranks (ala 1,2,3,4,..) to your data. However i still get a (different) error for which i don't have an explanation. Maybe the size of your raster is incorrect... library(sp);...

Only top voted, non community-wiki answers of a minimum length are eligible