Tag Info

Hot answers tagged

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

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'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 ...


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

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 ...


2

gdal_rasterize is not a python module, but an exe file. You can not call it that easy inside the python console. See this blogpost on how to wrap the operating system around it: http://geoinformaticstutorial.blogspot.de/2012/11/convert-shapefile-to-raster-with-gdal.html import os os.system('gdal_rasterize -a ICE_TYPE -where \"ICE_TYPE=\'Open Water\'\" ...


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... ...


1

You do not need a for loop. Just intersect everything at once and then add line lengths to the new line segments using the "SpatialLinesLengths" function in sp. Then, using the raster package rasterize function with the fun=sum argument you can create a raster with the sum of the line length(s) intersecting each cell. Using the above answer and associated ...


1

Easiest and most straight-forward way: Assume you have a column with a unique point identifier (the species name) Split your Point layer by this Attribute (QGIS -> Data Management -> Split) Rasterize each individual point layer for instance with the GDAL Rasterize Tool, or the SAGA or GRASS tools available in the Processing Toolbox. Make sure that you use ...


1

Assuming you know how to create the hectare sized grid (using the Vector->Research tools->Vector grid) then you can import both the point shapefile and the grid polygons into SpatiaLite and with an aggregate query get the totals as an attribute column in each grid sqare. For example if you have an id column in the grid polygon layer, and a ...



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