New answers tagged

1

The polygon ended up being a red herring. By chance I realized that the output from the code above was not a blank raster, but instead one at such a large scale that I couldn't see the small 0.6m radius raster. This issue of extent was fixed by changing the extent used in the Clip_management function to the extent of the buffer being used to clip the raster. ...


1

It's often easier to use the GDAL python wrappers. See my attempt below. If you still get errors, check that both raster and shapefile have geographic information (i.e. you can overlap them in QGIS or something like that). from osgeo import gdal from osgeo import ogr def dump_poly(raster_fname, vector_fname, ifeat): # New filename. Assumes input raster ...


0

I found the processing toolbox raster calculator in QGIS 3.16.15 works but not the calculator in the menu bar. I got valid expressions from this.


2

if I'm not mistaken, you want to take the coordinates of the drawing and send it to a service after the drawing on the map is finished. If you take a look at the Sketch's events, it is clearly explained how you can do it. Sketch' events For example, using the code below, you can reach the corner coordinates of the drawn polygon after the polygon drawing ...


1

Thanks to the link posted by @Babel, I was able to solve the problem. Example for the green color: Use "Identify Features" button on the input image and click on a number of green areas of the map. While doing so, note the entries in "Band1", "Band2", "Band3". Identify the maximum and minimum values for the ...


0

This is a duplicate of a question on SO. There are many pitfalls when using the C++ interface. #include <gdal/gdal.h> #include <gdal/gdal_priv.h> #include <gdal/gdalwarper.h> #include <gdal/ogrsf_frmts.h> int main() { const char *inputPath = "input.tif"; const char *outputPath = "output.tif"; // clipper ...


1

Still not sure what was causing the error, but I created a blank map with just three layers - the ortho, line feature and tax map. Extracted the necessary tax parcel again, and ran the clip, which worked.


2

In a shapefile, there is no automatically updated area field. All the attribute values remain unchanged after clipping, including the area field. You must compute again the area of your polygons (right click on the field, then "calculate geometry" to update the area of your polygons. Note that if you worked with a geodatabase, the shape_area field ...


2

Be sure your polygons have a unique id. Extract vertices Create Voronoi polygons Aggregate voronoi polygons based on the unique id. Resulting polygons outlined in red:


1

As mentioned already by @Erik, you first have to save the raster to a local file. Right click on the layer in the layer panel / Export / Save as..., define path/filename, set desired extent and resolution of the raster, see screenshot. If you afterwards want to clip the raster with a polygon, set this polygon layer's extent as the extent for the raster ...


1

The rasterio documentation for the mask function is not very clear here. The shape parameter must be an iterable of geometries, not a simple geometrie. The documentation of the shape parameter (i.e. "The values must be a GeoJSON-like dict or an object that implements the Python geo interface protocol...") describes the nature of the values ...


6

If this is something you do alot, you can also build a model to clip then apply a saved style: Export the style as a QGIS Layer style file Create a model which clip and then set the style using the style file:


7

I guess, it is an expected behaviour. QGIS changes the color scheme depending on min/max values of new raster. To keep the same scheme for the new raster: Right click on the former satellite image > Styles > Copy Style Right click on the clipped image > Styles > Paste Style


1

Your question has two pieces - clipping by the red polygons, and then extracting the max/min values. To clip use Extract by Mask (demdata as input raster, red polygons as input mask). This will get you new small raster layers of only those areas under the red polygons. If you do not care about these raster subsets as their own layers then skip this step - it ...


Top 50 recent answers are included