Hot answers tagged

13

One possible tool is Geometry by expression in the Processing Toolbox > Vector geometry. A Geometry expression to create lines (length= 100 m) is as below: make_line(project($geometry, 50, radians("angle")), project($geometry, 50, radians("angle"+180))) project($geometry, 50, radians("angle")) part creates a new point by moving your points to "angle" ...


6

To provide the response based on @artwork21 comment. To identify areas in one shapefile that contain the areas in a different shapefile as related to your soils data. You can than extract the data in your attribute table using a Spatial Join feature. Here is a tutorial using QGIS that you can reference Performing Spatial Joins I've included a few of the ...


6

I put an example of solving the same task with a pyqgis (3.2) standalone application. Below the python code from qgis.core import QgsPointXY, QgsApplication, QgsVectorLayer, QgsFeature, QgsGeometry from PyQt5.QtWidgets import QApplication import sys import math def main(): print('Start program') qgis_prefix_path = 'C:\\OSGeo4W64\\apps\\qgis' ...


6

Try outputting a specific format to memory using the special "/vsimem" virtual filesystem. For example:


6

The built-in $length function will only get you the 'horizontal' length along the line, not the true length allowing for the slope. To calculate this: Take your vector layer you created using 'Points to path' and use 'Explode lines'. This will split your single line into multiple lines with breaks located at every vertex. On this new layer, open field ...


5

Yes, you can use the feature.set()option which Feature Overview covers with these examples: // Make a feature and set some properties. var feature = ee.Feature(ee.Geometry.Point([-122.22599, 37.17605])) .set('genus', 'Sequoia').set('species', 'sempervirens'); // Get a property from the feature. var species = feature.get('species'); print(species); // Set ...


5

The basic OSM data model (nodes, ways and relations) is described at Elements. The XML format is described at OSM XML, larger extracts usually use PBF instead of XML, PBF has performance advantages (size, speed). OSM is mainly a geographic database. It doesn't contain "colors" (well, there are a few exceptions like the color of a particular building). ...


5

You will need to build an expression like the one in Writing If-Then Statement in ArcGIS Field Calculator using Python Parser? You need an if, elif, elif, else statement. Set your language to Python in the Field Calculator. Put this in the code block: def rc(f): if 10 >= f >= 0: return "rice" elif 15 >= f >= 11: return "wheat" ...


4

pgAdmin 4 has now a Geometry Data Viewer since version 4.3.3 (release date: sept/2018; see pgAdmin release notes). PostGIS extension needs to be enabled in the PostgreSQL database. The Geometry Data Viewer will display results on a map canvas from queries returning geometry and geography columns. If the SRID is 4326 results will be displayed over an ...


4

Create a grid (vector -> research tools -> create grid) covering the area of the city you need to be covered. Your gridsize seems to be about 100 by 100 m, use this for vertical and horizontal distances. Make sure you get polgyons, not any other type of grid. Make sure your grid-polygons all have an ID. Use vector -> data management tools -> join ...


4

While it isn't deleting, per se, this will create a new feature with your desired geometry. I am not a fan of modifying original geometry as it can lead to data loss. layer = iface.activeLayer() features = layer.getFeatures() for feat in features: line = feat.geometry().asMultiPolyline() # debug print (line) # example uses only one feature line = ...


4

If you just want an outpout list with the result, I would recommend to use a database e.g. PostgreSQL + PostGIS or Spatialite. There you can do it with a simple statement like this: select l.nameofline, p.nameofpolygon, (st_length(ST_Intersection(l.geom,p.geom)) / st_length(l.geom)) * 100 as linepercentage from lines l join polygons p on (st_intersects(l....


4

It's simple Step One - "Vector> Geoprocessing> Difference"; Step Two - “Analysis Tools> Split Composite Objects” (This step is necessary in order to convert a multipolygon to a polygon, otherwise the result may not be accurate); the third step "select a layer in the layers panel with the name" Single_parts ", click on the right mouse button and in the pop-...


4

Use Translate, in the toolbox: here I set dx and dy both to .71*Height to simulate a 45° sun incidence, but you can use whatever combination you prefer. This creates a new layer, which you have to move under your original one, and set to a dark shade. Optionally, for a smoother rendering, set a slight blur with the Draw effect:


4

Similar to the answer provided by @csk - I would: 1. Use the Merge vector layers tool to combine all the catchments into a single layer. 2. Use the Join attributes by location (summary) tool to count the OBJECTID (but could be any unique ID column) of the past landslides that intersects the catchments. This will create a new catchments layer that contains ...


4

I think the rule would be to use vector that are digitized for the specific scale you will use, for exemple Natural Earth dataset is available at 1:10m, 1:50m, and 1:110 million scales with varying level of detail, you would choose the one that is closest to your intended scale use. By looking at your picture I would said your first picture is at a too ...


4

Yes, you can just loop through the individual features and save them like so: library (sf) dat <- read_sf ("~/data.shp") for (i in seq_len (nrow (dat))) { fname <- paste0 ("~/split_", i, ".shp") write_sf (dat [i, ], fname) }


3

Rasterio provides a from_bounds method that generates an affine transform for you. import rasterio from rasterio.features import rasterize from rasterio.transform import from_bounds import geopandas as gpd # Load some sample data # ECOWAS region (West Africa) - Hydropower potential and River network df = gpd.read_file('https://energydata.info/dataset/...


3

You have a multipart polyline (two line but with only one set of attribute) if you run the "Multipart to singleparts" tool (from the processing toolbox) you will get two line with the same attribut but a different ID Another way to go is to toggle editing and use the "Split Parts" editing tool from the edit toolbar. After that you could export each line to ...


3

You could do an old-school buffer-debuffer technique (discussed many time on this site e.g. here and elsewhere too) followed by hole removal. The key here will be the amount you buffer-debuffer by. By looking at the second image I'd go for about 2 or 3 times the raster resolution. Alternatively you could try using a concave hull tool (aka alpha shape). ...


3

I tried this on a whim and it actually worked. ArcGIS MapServer services can apparently also act as ArcGIS FeatureServer services. I just added an ArcGISFeatureServer using the MapServer URL and it started pulling down polygons instead of tiles.


3

If you write line in the search box of Processing toolbox in QGIS 3.4, you will have Polygons to lines:


3

Add an additional style, using markers on top of your existing style. Markers can be rotated, either based on a standard value, or on a feature-specific value which has to be stored in its attributes.


3

For the record - You can now do this easily with QGIS alone (since later QGIS versions): first use 'explode lines' tool, yielding all line segments, then calculate azimuth with field calculator: degrees(azimuth( start_point($geometry), end_point($geometry)) ) finished..


3

You're using a fixed distance buffer when you should be using a single sided buffer. Please see usage examples below. For QGIS 3: x = processing.run("qgis:singlesidedbuffer", {'INPUT':'input.shp','DISTANCE':10,'SIDE':0,'SEGMENTS':8,'JOIN_STYLE':0,'MITER_LIMIT':2,'OUTPUT':'memory:'}) For QGIS 2.X, 5th parameter indicates side (0=right, 1=left): x = ...


3

For vector layers the data projection should be specified in the format, not the source: source: new VectorSource({ url: 'img/estradas.geojson', format: new GeoJSON({dataProjection: 'EPSG:31982'}) }),


3

You are creating a raster of 1 pixel with and 1 pixel height. Your raster have 1 cell, which is touched by the vector and assumes that value. There must be enough pixels to find cells that not meet the condition of being touched by the vector.


3

This example is directly from the documentation @JRR provided. You can use writeOGR() from the rgdal package to write the convex hull polygons representing tree canopies to shapefile. library(lidR) library(rgdal) las = readLAS("/path/to/your/points.las") plot(las) # Classify ground points las = lasground(las, csf()) plot(las, color = "Classification") # ...


3

Create grid can be used to create single polygon. You just need to set xmin, xmax, ymin, ymax to match with horizontal/vertical spacing. Aspect ratio has to be calculated manually, but it won't be difficult.


3

This bug was reported and should be fixed in the next update: https://issues.qgis.org/issues/21475


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