Buffer the lines with dissolve so all nearby lines are inside the buffer, but not so wide that the other line clusters are included
Multipart to Singlepart
Field calculate a group attribute (@row_number)
Intersect with lines to get the group attribute on each line
Extract one random line per subset/group:
This solution relies on two relatively new functions of QGIS expressions: array_sum(), avalilable since QGIS 3.18 and overlay_nearest(), available since QGIS 3.16.
Calculate the total length of the roads per province.
Calculate the length of the percentage you want to get. In my example, the total length is 1090566 m, 10% thus is 109056.6 m
Remark: see ...
This seems to be a classical case for a Two-point equidistant projection, see: Wikipedia: Two-point equidistant projection and ArcGIS: Two-point equidistant.
Create a custom projecton, based on the pre-installed Sphere_Two_point_Equidistant projection (ESRI:53031) with the two points in England and Germany as the two points.
For my example of London (51 N, ...
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 cells where the difference between them is less than 100 km. This would create a third grid, which you would display on a map.
There are probably more elegant ...
Meanwhile (since QGIS 3.16 with the new overlay_crosses function) you can use QGIS expressions to automatically calculate what you want. The expression to use on the lines layer and referring to the polygon layer (replace polygon with the name of your polygon layer) looks like this - see below for an explanation. You can use this expression with field ...
To be mathematically strict, the middle point of polyline is not placed in the average of LatLng coordinates of starting and ending point (as suggested in the other answers or using getCenter() method).
Polyline in Leaflet draws a straight line over a Mercator projection, so latitudes are deformed. When working on small scale, like the example on this post, ...
You can use QGIS expressions with Geometry Generator or Geometry by expression for this - see here for details about these two options. In both cases, simply use this expression: close_line( $geometry).
Screenshot: Blue=original line; red=line created with the above expression:
What you seem to mean is how often does each line cross the boundary (outline) of each polygon. When a line crosses a polygon, the number of intersection points is infinite as the intersection has the form of a line and this consists of an infinite number of points.
To count the number of crossing points with the boundary, first convert your polygons to ...
I think that you should be able to do this by buffering your existing polygons using a distance perhaps 10% of the width of your smallest polygons, and using the option to have the inner borders of your buffers dissolved.
This should give you a single polygon feature suitable for Creating Centrelines from Road Polygons/Casings using ArcGIS Desktop?
Create end points (NODES) and delete identical in shape. Transfer nodes OIDs to lines as described here to find from and to nodes of lines. Create COMBO field using something like:
str(min( !TI!, !FI!)) + "_" + str (max(!TI!, !FI!))
in order to find twins:
Delete identical using this field.
Assuming this represents the skeleton of a lake I can think of several ways to automate the trimming back to the centreline. But they all have a flaw, how do you identify the inlets/outlet of the lake and exclude those from any trimming operation. You need to have previously flagged these in some way which inevitably means a manual intervention and thus the ...