wingnut
  • Member for 10 months
  • Last seen more than a month ago
What is the most efficient way to create millions of lines using Python from coordinates?
Accepted answer
12 votes

I would just use a script to go from CSV to JSON. You don't need a GIS or any special libraries, just string handling. Here's a Python example. First, set up some string placeholders: header = '{ &...

View answer
What are the units in EPSG:4326
Accepted answer
8 votes

Decimal degrees. Not so much the CRS as the way computers handle floats. They use decimal numbers, not sexagesimal values. Pretty much every CRS uses decimal numbers, whether they are spheroidal or ...

View answer
Keeping symbology for intersection in QGIS
7 votes

Or right click on the meticulous layer and select Styles. You can copy and paste!

View answer
Get a certain part of the project name in QGIS print composer label field?
6 votes

right(@project_basename,3) could be an option

View answer
Note QGIS raster calculator defaults to not being accurate
Accepted answer
6 votes

This seems to happen by default. The maximum you see is an estimate based on sampling. You want the actual maximum of all samples in the raster. In the Layer Styling panel, under Accuracy, select ...

View answer
Populating attributes while creating polygons in for-loop from CSV using PyQGIS
5 votes

I have had this problem too. You have: vl = QgsVectorLayer("Polygon?crs=EPSG:2193", "Polygons", "memory") Maybe add the attribute definitions into the uri. uri = '...

View answer
Selecting the transect lines which touches the divide of a polygon from the river line
Accepted answer
5 votes

If you want to create this sort of thing, then there is a way. I am assuming you have already broken the transects at the river. Looks like you have. Convert the watershed polygon to a line. This ...

View answer
Exporting same attribute values to separate layers and merging them in QGIS
Accepted answer
5 votes

Look into Split Vector Layer in QGIS's Processing Toolbox. You can use a field to split an existing layer into layers containing unique values of that field.

View answer
Plotting line on QGIS
4 votes

On a map, you could make 2 rasters (rectangular grids). One would have the distance to the German location, and the other to the point in the UK. You could then use the Raster Calculator to highlight ...

View answer
Iterating clipping process through list of geodataframes
Accepted answer
4 votes

A list comprehension is very Python. clipped = [gpd.clip(s, boundary) for s in shapefiles] But often it's easier and more flexible to loop, especially if there are clip polygons for each shapefile. ...

View answer
Is it possible to check the z factor of a hillshade in the layer properties in QGIS?
Accepted answer
3 votes

No, it's just a display method of an elevation file, and the layer properties just describes the elevation file (not the hillshade). Even if you produce the hillshade using gdaldem, the resulting TIF ...

View answer
Counting the number of times a polygon has been intersected by a buffer layer
3 votes

You can use a simple query in DB Manager, like: SELECT bldg.* , count(quakes.id) FROM "New Scratch Layer" AS bldg, Buffered AS quakes WHERE st_intersects(quakes.geometry,bldg.geometry) GROUP ...

View answer
How to construct a grid over a given position from polygons?
Accepted answer
3 votes

You know the spacing is 100m in both x and y. Go to Vector - Research Tools - Create Grid Grid Type - set it to Rectangle Grid Extent set it to Calculate from Layer and select the polygon layer - it ...

View answer
How to smooth the DTM?
3 votes

Change the resampling option for the rendering. Here is an example with default display: The blocky nature is due to the way hillshades are sampled within cells. The Layer Styling panel has ...

View answer
Reducing size of labels automatically to fit within polygons
3 votes

You can make the font size constant in metres rather than points, so it will scale with the map. In Layer Styling, select Metres at Scale instead of Points. You can also make the size in points (or ...

View answer
No data in the attribute table when creating buffer in QGIS
3 votes

The Vector - Geoprocessing Tools - Buffer tool in QGIS is applied to all features in a layer. Buffered features can also be dissolved, so that overlapping buffers are not created, if required. This ...

View answer
How can I create a 10 day composite image of the snow cover extent using QGIS?
Accepted answer
3 votes

It must be the mean SCE for each pixel over the 10-day period. Raster values may or may not indicate snow (they could be land/water etc.) An approach could be: Remove all non-snow values (water, land,...

View answer
Rasterizing vector creates raster with all cells containing same value but different color using QGIS
Accepted answer
3 votes

Delete the fixed value for burn-in and use a value from a field. Then you'll get different raster values for different polygons. Use ID or some other field that you have in your polygons, eg 1 for ...

View answer
Subtracting two raster layers based on condition in QGIS
Accepted answer
3 votes

You might need more brackets, and you can replace logical AND with numerical *. (layer1_null = 0) * (layer2 != 0) selects the pixels that meet the criteria. (layer1_null = 0) * (layer2 != 0) * (...

View answer
Sorting out curved and straight lines in QGIS
2 votes

Create a segment from the first to last vertex and then for each interior point, determine its distance from this segment. Set a threshold. Below the threshold, the line is considered straight. Above ...

View answer
Vectorizing raster with values between 0 and 1 in QGIS
2 votes

Command line is the easiest, with GDAL tools. Convert the raster to XYZ data: gdal_translate -of XYZ input.tif input.csv Use an editor to filter out any nodata values in the CSV file if you prefer ...

View answer
Selecting features from a .shp file based on rasters pixel values
2 votes

Here is an example of the workflow. Use gdal_translate to convert the raster to XYZ format. Filter out nodata values from the resulting file. Add a header to each set ("X Y value"). Load ...

View answer
How can I execute SpatiaLite commands directly from the command line?
2 votes

spatialite -header -csv data.sqlite "select * from table" > file.csv

View answer
Unit of $area in the field calculator in Albers Equal Area projection (ESRI: 102033)
Accepted answer
2 votes

In QGIS, when you set the CRS, there is a window t the bottom that shows the WKT version of the CRS, and the Proj version. It contains the length unit. The area is the square of that. For South ...

View answer
Georeferencing Sentinel-3 LST product
Accepted answer
2 votes

Short answer: use GDAL tools to extract lat and long data from an .nc file. Merge it with the data from any band you want to see to make an x,y,z dataset. Convert the irregular x,y,z data to a ...

View answer
Clustering spatial data based on categorical attribute
2 votes

I would explore the various clustering plugins available for QGIS. "Attribute based clustering" Plugin may be what you need, but there are several more available.

View answer
gdal.RasterizeLayer can not burn any values or use attribute from shapefile in python
Accepted answer
2 votes

Copied your code and made a grid of rectangles. It also didn't work. After the rasterize statement, add: target_ds.FlushCache() del target_ds It works!

View answer
Finding the gaps/holes in DEM
2 votes

The DEM will have a nodata value that means there is a void (no information there). Load the .hgt file into QGIS / Arc, look at the layer properties, to find out what it is. Visually, you could: Make ...

View answer
Expression to extract part of an address
2 votes

Maybe some Python list and string functions can help. temp = text.split(',') makes an array of everything that was separated by commas. temp[0] contains '111 Example St' temp2 = temp[0].split() ...

View answer
Finding the average value of a gradient in a certain region in QGIS
2 votes

No coding required. Zonal Statistics are designed to do this. Show your raster. Make sure you know what the map's projection is. If it's lat/long, you are working in degrees (like this example), ...

View answer