8
votes
Accepted
Polygonizing a raster yields lots of little squares?
The reason for this is that while you see yellow pixels, or pink pixels, QGIS sees thousands of discrete colours
Zoom in really close to scanned map you'll see lots of noise - neighbouring pixels ...
7
votes
Accepted
Convert geojson to png
If you chose GeoTools it is a fairly simple process, fetch your geojson from somewhere:
URL states = new URL("http://geojson.xyz/naturalearth-3.3.0/ne_110m_admin_1_states_provinces.geojson");
...
7
votes
Accepted
Is it possible to open a raster or raster dataset contained in a file geodatabase with QGIS 3.X?
So I found the answer myself. I opened up the file geodatabase with ArcGIS and saw that it indeed contained raster datasets. So the answer is: Even the new QGIS completely ignores raster datasets when ...
7
votes
Convert sf data frame to raster in R
class(enn2mean)
[1] "sf" "data.frame"
Your file enn2mean is an sf, and writeRaster works with raster files only. You need to rasterize it, and then export it. This is one ...
6
votes
Conversion of OSM building to elevation raster
For flat roofs:
You could manually create a height attribute in the shapefile if you're just doing this for one building. Otherwise, you need to import the OSM and then export the Topology and select ...
6
votes
Excluding extent when polygonizing raster file using Python?
This can be achieved by applying a mask as the second argument in the Polygonize function, as stated in the GDAL documentation. The mask needs to be a separate raster layer, that has 0 where you don't ...
6
votes
Accepted
How to polygonize raster with range of values?
What you want to do is the re-classify the raster before polygonizing. You can GRASS tool r.recode for that (available in QGIS).
For a solution with raster calculator, see below.
Using GRASS r.recode
...
5
votes
Converting a raster to shapefile for only one value?
If you have SAGA installed under QGIS, you can use Victorising grid classes tool located in Processing Toolbox -> SAGA -> Shapes - Grid -> Victorising grid classes. As you can see in the ...
5
votes
Converting SpatialGridDataFrame into polygon shapefile in R?
Note that package sp now allows conversion of SpatialGridDataFrame into SpatialPolygonsDataFrame, you just need to use:
as(., "SpatialPolygonsDataFrame")
and this will contain all the attributes of ...
5
votes
Flattening multi-band raster to single-band raster in ArcMap?
Suggestion from Stephen Lead is sufficient for grayscaled rasters but not for coloured rasters (e.g. DOF). If you want to preserve the colours (conversion is quite good) then use Copy Raster tool and ...
5
votes
Accepted
Excluding extent when polygonizing raster file using Python?
Normally you don't need a mask for that task, but RGB values of the polygon areas equals 0. So you need to change them into a value (for example 125) and to change others into 0. Since all bands have ...
5
votes
Accepted
How to write PNG file from a raster using rasterio?
You're trying to write three bands into the first (and only) band of a single band output raster and you need to reshape your rgb array from (rows, cols, bands) to (bands, rows, cols).
You probably ...
4
votes
Accepted
Importing XYZ ASCII Grid Data Into QGIS: Why does GDAL resize the raster?
This seems to be a bug in QGIS, utilizing some odd behaviour of the gdalwarp utility. If gdalwarp does not like the input raster (in this case due to the y axis positive down), it creates a new raster ...
4
votes
Combine overlapping rasters and include cells with no data
The above mentioned approach to use Con(IsNull("raster"), 0, "raster") to transform NoData values to zero is indeed very smart. Using this approach, make sure that the extent for every processed ...
4
votes
Convert geojson to png
I read points from a shapefile and burn in a png,
also with a color classification.
The recipe is in python, you need in java
but the structure is the same, only must to learn the
image java api:
...
4
votes
Accepted
Gdal.BuildVRT not creating any output
I encountered the same problem. When the vrt is returned as a dataset, you can use this dataset to invoke FlushCache() which made the problem for me disappear. I can remember that this was not ...
4
votes
Using Zonal Statistics to determine percent forest cover in grid cells?
Try reclassifying your raster (Spatial Analyst > Reclass > Reclassify) so that every pixel that used to have a value (forested) gets a value of 1, and everything that didn't becomes 0.
Then, you ...
4
votes
Accepted
.tif file conversion to .bil format
Read the tif file into an R object and save it as a .bil file.
> library(raster)
> r = raster("r.tif")
> writeRaster(r,"r.bil")
>
Note this results in three new files, with the data and ...
4
votes
Accepted
Burning zeros instead of nodata in GDAL rasterize
You are specifically telling gdal_rasterize to set 0 to nodata with the -a_nodata 0.0 parameter you use.
You also specify -init -999999999.0 which doesn't make much sense as your output type is Byte (...
4
votes
Converting 5m DTM Raster to 0.5 m resolution in QGIS
The Warp (Reproject) tool will resample for you.
You need to set the Output file resolution to 0.5 in your case, and also pick an appropriate Resampling method:
4
votes
Converting 5m DTM Raster to 0.5 m resolution in QGIS
Resampling 5 m pixels into 0.5 m pixel size is waste of disk space but it may be necessary. However, with QGIS it should be possible to use the GDAL virtual format (VRT) without resampling. See the ...
4
votes
Accepted
Converting float32 format raster in integer type raster
Use the GDAL Translate algorithm, leave all the parameters as default, just change the Output data type parameter (in the lower part of the algorithm dialog) to the desired data type.
And the data ...
3
votes
Python/GDAL--Handling Big Rasters and avoid MemoryErrors?
You could use the python module RIOS (Raster I/O Simplification). It reads an image into memory in a block of 400 x 400 x nbands and writes the output to a new image. It handles the opening of the ...
3
votes
What resampling method is used in the raster 'Save as...' dialog?
If the QGIS library is using GDAL for a backend, my guess (without checking QGIS source!) is that it's using nearest because that's the default for both the gdalwarp and gdal_translate utilities.
In ...
3
votes
Accepted
Preserving nodata values when using gdal_translate -scale
Instead of using NODATA, in this case it is better to use a mask:
As the NODATA value is 0, I can easily create the mask with -co NBITS=1 as everything above a value of 1 will be cut to 1.
# Create ...
3
votes
Accepted
How to display Flow Direction arrows + Burn Stream Netwok in QGIS?
Regarding your first question (it's usually better to focus on one question per post):
In GRASS you can display vectors with direction arrows. In the gui there's a checkbox "Display direction of ...
3
votes
Converting each cell value of raster into floating-point representation using QGIS?
I was able to achieve this by utilizing the GdalTools plugin.
GDAL -> GDAL Conversion -> Translate (convert format).
I chose the output raster to have the data type float32, and received a GeoTIFF ...
3
votes
Accepted
How do I improve the resolution of a raster layer
You could use the GRASS tool r.resamp.interp which allows you to resample your raster to a finer resolution by specifying the cell size.
3
votes
Normalizing a digital surface model?
If I have interpreted your question correctly, I believe that what you are trying to do is to remove the underlying ground surface from your digital surface model (DSM). I would recommend using a ...
3
votes
Add layer to RasterBrick R
The addLayer function works by stacking all its arguments - to add a layer to an existing raster or stack make it the first argument. This is shown in the help:
file <- system.file("external/test....
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
raster-conversion × 328raster × 112
qgis × 95
arcgis-desktop × 87
gdal × 33
geotiff-tiff × 28
python × 19
arcmap × 18
coordinate-system × 17
arcpy × 16
r × 16
arcgis-10.1 × 16
raster-calculator × 16
rasterization × 13
polygon × 12
polygonize × 12
arcgis-10.2 × 11
dem × 11
convert × 10
gdal-translate × 10
shapefile × 9
vector × 9
grass-gis × 9
arcgis-10.0 × 8
arcgis-pro × 7