Skip to content

Commit 4ff8429

Browse files
nyalldawsonnirvn
authored andcommittedJun 12, 2019
[processing] Port "Points along geometry" to QgsFeatureBasedAlgorithm
(and c++), allow distance/start/end offset to be dynamic, avoid algorithm "hangs" when inappropriately small (or 0) distances are used
1 parent e0eedc5 commit 4ff8429

24 files changed

+1450
-150
lines changed
 

‎python/plugins/processing/algs/help/qgis.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,6 @@ qgis:creategridlines: >
9494

9595
The top-left point (minX, maxY) is used as the reference point. That means that, at that point, an element is guaranteed to be placed. Unless the width and height of the selected extent is a multiple of the selected spacing, that is not true for the other points that define that extent.
9696

97-
qgis:createpointsalonglines: >
98-
This algorithm creates a points layer, with points distributed along the lines of an input vector layer. the distance between points (measured along the line) is defined as a parameter.
99-
100-
Start and end points can be defined, so the first and last point do not fall on the line first and last node. Start and end points are defined as distances, measured from the first and last nodes of the lines, in the units of the projection used by the lines layer.
101-
10297
qgis:createspatialindex: >
10398
Creates an index to speed up access to the features in a layer based on their spatial location. Support for spatial index creation is dependent on the layer's data provider.
10499

‎python/plugins/processing/algs/qgis/PointsAlongGeometry.py

Lines changed: 0 additions & 142 deletions
This file was deleted.

‎python/plugins/processing/algs/qgis/QgisAlgorithmProvider.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@
8484
from .NearestNeighbourAnalysis import NearestNeighbourAnalysis
8585
from .Orthogonalize import Orthogonalize
8686
from .PointDistance import PointDistance
87-
from .PointsAlongGeometry import PointsAlongGeometry
8887
from .PointsDisplacement import PointsDisplacement
8988
from .PointsFromLines import PointsFromLines
9089
from .PointsFromPolygons import PointsFromPolygons
@@ -195,7 +194,6 @@ def getAlgs(self):
195194
NearestNeighbourAnalysis(),
196195
Orthogonalize(),
197196
PointDistance(),
198-
PointsAlongGeometry(),
199197
PointsDisplacement(),
200198
PointsFromLines(),
201199
PointsFromPolygons(),
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ogr:FeatureCollection
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://ogr.maptools.org/ points_along_lines_end_offset.xsd"
5+
xmlns:ogr="http://ogr.maptools.org/"
6+
xmlns:gml="http://www.opengis.net/gml">
7+
<gml:boundedBy>
8+
<gml:Box>
9+
<gml:coord><gml:X>2</gml:X><gml:Y>-3</gml:Y></gml:coord>
10+
<gml:coord><gml:X>9</gml:X><gml:Y>3</gml:Y></gml:coord>
11+
</gml:Box>
12+
</gml:boundedBy>
13+
14+
<gml:featureMember>
15+
<ogr:points_along_lines_end_offset fid="lines.0">
16+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>6,2</gml:coordinates></gml:Point></ogr:geometryProperty>
17+
<ogr:distance>0</ogr:distance>
18+
<ogr:angle>90</ogr:angle>
19+
</ogr:points_along_lines_end_offset>
20+
</gml:featureMember>
21+
<gml:featureMember>
22+
<ogr:points_along_lines_end_offset fid="lines.0">
23+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>7,2</gml:coordinates></gml:Point></ogr:geometryProperty>
24+
<ogr:distance>1</ogr:distance>
25+
<ogr:angle>90</ogr:angle>
26+
</ogr:points_along_lines_end_offset>
27+
</gml:featureMember>
28+
<gml:featureMember>
29+
<ogr:points_along_lines_end_offset fid="lines.0">
30+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>8,2</gml:coordinates></gml:Point></ogr:geometryProperty>
31+
<ogr:distance>2</ogr:distance>
32+
<ogr:angle>90</ogr:angle>
33+
</ogr:points_along_lines_end_offset>
34+
</gml:featureMember>
35+
<gml:featureMember>
36+
<ogr:points_along_lines_end_offset fid="lines.0">
37+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>9,2</gml:coordinates></gml:Point></ogr:geometryProperty>
38+
<ogr:distance>3</ogr:distance>
39+
<ogr:angle>45</ogr:angle>
40+
</ogr:points_along_lines_end_offset>
41+
</gml:featureMember>
42+
<gml:featureMember>
43+
<ogr:points_along_lines_end_offset fid="lines.0">
44+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>9,3</gml:coordinates></gml:Point></ogr:geometryProperty>
45+
<ogr:distance>4</ogr:distance>
46+
<ogr:angle>22.5</ogr:angle>
47+
</ogr:points_along_lines_end_offset>
48+
</gml:featureMember>
49+
<gml:featureMember>
50+
<ogr:points_along_lines_end_offset fid="lines.2">
51+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>2,0</gml:coordinates></gml:Point></ogr:geometryProperty>
52+
<ogr:distance>0</ogr:distance>
53+
<ogr:angle>0</ogr:angle>
54+
</ogr:points_along_lines_end_offset>
55+
</gml:featureMember>
56+
<gml:featureMember>
57+
<ogr:points_along_lines_end_offset fid="lines.2">
58+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>2,1</gml:coordinates></gml:Point></ogr:geometryProperty>
59+
<ogr:distance>1</ogr:distance>
60+
<ogr:angle>0</ogr:angle>
61+
</ogr:points_along_lines_end_offset>
62+
</gml:featureMember>
63+
<gml:featureMember>
64+
<ogr:points_along_lines_end_offset fid="lines.4">
65+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>7,-3</gml:coordinates></gml:Point></ogr:geometryProperty>
66+
<ogr:distance>0</ogr:distance>
67+
<ogr:angle>90</ogr:angle>
68+
</ogr:points_along_lines_end_offset>
69+
</gml:featureMember>
70+
<gml:featureMember>
71+
<ogr:points_along_lines_end_offset fid="lines.5">
72+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>6,-3</gml:coordinates></gml:Point></ogr:geometryProperty>
73+
<ogr:distance>0</ogr:distance>
74+
<ogr:angle>45</ogr:angle>
75+
</ogr:points_along_lines_end_offset>
76+
</gml:featureMember>
77+
<gml:featureMember>
78+
<ogr:points_along_lines_end_offset fid="lines.5">
79+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>6.70710678118655,-2.29289321881345</gml:coordinates></gml:Point></ogr:geometryProperty>
80+
<ogr:distance>1</ogr:distance>
81+
<ogr:angle>45</ogr:angle>
82+
</ogr:points_along_lines_end_offset>
83+
</gml:featureMember>
84+
<gml:featureMember>
85+
<ogr:points_along_lines_end_offset fid="lines.5">
86+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>7.41421356237309,-1.58578643762691</gml:coordinates></gml:Point></ogr:geometryProperty>
87+
<ogr:distance>2</ogr:distance>
88+
<ogr:angle>45</ogr:angle>
89+
</ogr:points_along_lines_end_offset>
90+
</gml:featureMember>
91+
<gml:featureMember>
92+
<ogr:points_along_lines_end_offset fid="lines.5">
93+
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>8.12132034355964,-0.878679656440358</gml:coordinates></gml:Point></ogr:geometryProperty>
94+
<ogr:distance>3</ogr:distance>
95+
<ogr:angle>45</ogr:angle>
96+
</ogr:points_along_lines_end_offset>
97+
</gml:featureMember>
98+
<gml:featureMember>
99+
<ogr:points_along_lines_end_offset fid="lines.6">
100+
<ogr:distance xsi:nil="true"/>
101+
<ogr:angle xsi:nil="true"/>
102+
</ogr:points_along_lines_end_offset>
103+
</gml:featureMember>
104+
</ogr:FeatureCollection>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<xs:schema targetNamespace="http://ogr.maptools.org/" xmlns:ogr="http://ogr.maptools.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" elementFormDefault="qualified" version="1.0">
3+
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/>
4+
<xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
5+
<xs:complexType name="FeatureCollectionType">
6+
<xs:complexContent>
7+
<xs:extension base="gml:AbstractFeatureCollectionType">
8+
<xs:attribute name="lockId" type="xs:string" use="optional"/>
9+
<xs:attribute name="scope" type="xs:string" use="optional"/>
10+
</xs:extension>
11+
</xs:complexContent>
12+
</xs:complexType>
13+
<xs:element name="points_along_lines_end_offset" type="ogr:points_along_lines_end_offset_Type" substitutionGroup="gml:_Feature"/>
14+
<xs:complexType name="points_along_lines_end_offset_Type">
15+
<xs:complexContent>
16+
<xs:extension base="gml:AbstractFeatureType">
17+
<xs:sequence>
18+
<xs:element name="geometryProperty" type="gml:PointPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/>
19+
<xs:element name="distance" nillable="true" minOccurs="0" maxOccurs="1">
20+
<xs:simpleType>
21+
<xs:restriction base="xs:decimal">
22+
</xs:restriction>
23+
</xs:simpleType>
24+
</xs:element>
25+
<xs:element name="angle" nillable="true" minOccurs="0" maxOccurs="1">
26+
<xs:simpleType>
27+
<xs:restriction base="xs:decimal">
28+
</xs:restriction>
29+
</xs:simpleType>
30+
</xs:element>
31+
</xs:sequence>
32+
</xs:extension>
33+
</xs:complexContent>
34+
</xs:complexType>
35+
</xs:schema>
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)