Navigation Menu

Skip to content

Commit

Permalink
Fix v.rectify
Browse files Browse the repository at this point in the history
  • Loading branch information
nicogodet committed Oct 14, 2021
1 parent 515747d commit d234873
Show file tree
Hide file tree
Showing 7 changed files with 278 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/grass7/ext/v_rectify.py
Expand Up @@ -46,6 +46,6 @@ def processCommand(alg, parameters, context, feedback):
with open(pointsName, "w") as tempPoints:
tempPoints.write(inlinePoints)
alg.removeParameter('inline_points')
parameters['points'] = tempPoints
parameters['points'] = pointsName

alg.processCommand(parameters, context, feedback, True)
alg.processCommand(parameters, context, feedback)
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ogr.maptools.org/ v_rectify.xsd"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>-204.115</gml:X><gml:Y>12.198</gml:Y></gml:coord>
<gml:coord><gml:X>-84.78</gml:X><gml:Y>124.318</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>

<gml:featureMember>
<ogr:v_rectify fid="v_rectify.0">
<ogr:geometryProperty><gml:Point><gml:coordinates>-204.115,12.198</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>1</ogr:id>
<ogr:local_x>-204.115</ogr:local_x>
<ogr:local_y>12.198</ogr:local_y>
<ogr:utm37n_x>433392.793</ogr:utm37n_x>
<ogr:utm37n_y>3823100.684</ogr:utm37n_y>
</ogr:v_rectify>
</gml:featureMember>
<gml:featureMember>
<ogr:v_rectify fid="v_rectify.1">
<ogr:geometryProperty><gml:Point><gml:coordinates>-84.78,124.318</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>2</ogr:id>
<ogr:local_x>-84.780</ogr:local_x>
<ogr:local_y>124.318</ogr:local_y>
<ogr:utm37n_x>433389.825</ogr:utm37n_x>
<ogr:utm37n_y>3823061.376</ogr:utm37n_y>
</ogr:v_rectify>
</gml:featureMember>
<gml:featureMember>
<ogr:v_rectify fid="v_rectify.2">
<ogr:geometryProperty><gml:Point><gml:coordinates>-87.466,84.973</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:id>3</ogr:id>
<ogr:local_x>-87.466</ogr:local_x>
<ogr:local_y>84.973</ogr:local_y>
<ogr:utm37n_x>433272.705</ogr:utm37n_x>
<ogr:utm37n_y>3822989.470</ogr:utm37n_y>
</ogr:v_rectify>
</gml:featureMember>
</ogr:FeatureCollection>
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/>
<xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
<xs:complexType name="FeatureCollectionType">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureCollectionType">
<xs:attribute name="lockId" type="xs:string" use="optional"/>
<xs:attribute name="scope" type="xs:string" use="optional"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="v_rectify" type="ogr:v_rectify_Type" substitutionGroup="gml:_Feature"/>
<xs:complexType name="v_rectify_Type">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>
<xs:element name="geometryProperty" type="gml:PointPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/>
<xs:element name="id" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:long">
<xs:totalDigits value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="local_x" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:totalDigits value="11"/>
<xs:fractionDigits value="3"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="local_y" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:totalDigits value="11"/>
<xs:fractionDigits value="3"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="utm37n_x" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:totalDigits value="11"/>
<xs:fractionDigits value="3"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="utm37n_y" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:totalDigits value="11"/>
<xs:fractionDigits value="3"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
@@ -0,0 +1,4 @@
-637.240 580.860 432843.854 3823560.989 1
-962.079 1086.419 432522.788 3824068.656 1
-1369.031 837.071 432114.226 3823822.337 1
-1877.673 775.273 431605.364 3823764.216 1
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ogr.maptools.org/ v_rectify.xsd"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>433272.7051863243</gml:X><gml:Y>3822989.469869608</gml:Y></gml:coord>
<gml:coord><gml:X>433392.7925092813</gml:X><gml:Y>3823100.684332959</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>

<gml:featureMember>
<ogr:outputbe49290dc4954e58b8b9bd6ae1936a08 fid="v_rectify.0">
<ogr:geometryProperty><gml:Point><gml:coordinates>433272.705186324,3822989.46986961</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:cat>1</ogr:cat>
<ogr:id>1</ogr:id>
<ogr:local_x>-204.115</ogr:local_x>
<ogr:local_y>12.198</ogr:local_y>
<ogr:utm37n_x>433392.793</ogr:utm37n_x>
<ogr:utm37n_y>3823100.684</ogr:utm37n_y>
</ogr:outputbe49290dc4954e58b8b9bd6ae1936a08>
</gml:featureMember>
<gml:featureMember>
<ogr:outputbe49290dc4954e58b8b9bd6ae1936a08 fid="v_rectify.1">
<ogr:geometryProperty><gml:Point><gml:coordinates>433392.792509281,3823100.68433296</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:cat>2</ogr:cat>
<ogr:id>2</ogr:id>
<ogr:local_x>-84.78</ogr:local_x>
<ogr:local_y>124.318</ogr:local_y>
<ogr:utm37n_x>433389.825</ogr:utm37n_x>
<ogr:utm37n_y>3823061.376</ogr:utm37n_y>
</ogr:outputbe49290dc4954e58b8b9bd6ae1936a08>
</gml:featureMember>
<gml:featureMember>
<ogr:outputbe49290dc4954e58b8b9bd6ae1936a08 fid="v_rectify.2">
<ogr:geometryProperty><gml:Point><gml:coordinates>433389.82521185,3823061.37592775</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:cat>3</ogr:cat>
<ogr:id>3</ogr:id>
<ogr:local_x>-87.466</ogr:local_x>
<ogr:local_y>84.973</ogr:local_y>
<ogr:utm37n_x>433272.705</ogr:utm37n_x>
<ogr:utm37n_y>3822989.47</ogr:utm37n_y>
</ogr:outputbe49290dc4954e58b8b9bd6ae1936a08>
</gml:featureMember>
</ogr:FeatureCollection>
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/>
<xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
<xs:complexType name="FeatureCollectionType">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureCollectionType">
<xs:attribute name="lockId" type="xs:string" use="optional"/>
<xs:attribute name="scope" type="xs:string" use="optional"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="outputbe49290dc4954e58b8b9bd6ae1936a08" type="ogr:outputbe49290dc4954e58b8b9bd6ae1936a08_Type" substitutionGroup="gml:_Feature"/>
<xs:complexType name="outputbe49290dc4954e58b8b9bd6ae1936a08_Type">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>
<xs:element name="geometryProperty" type="gml:PointPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/>
<xs:element name="cat" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:totalDigits value="16"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="id" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:totalDigits value="16"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="local_x" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="local_y" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="utm37n_x" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="utm37n_y" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
Expand Up @@ -525,6 +525,64 @@ tests:
fields:
fid: skip

- algorithm: grass7:v.rectify
name: v.rectify - Use text file
params:
'-3': false
-b: false
-o: false
GRASS_MIN_AREA_PARAMETER: 0.0001
GRASS_OUTPUT_TYPE_PARAMETER: 0
GRASS_SNAP_TOLERANCE_PARAMETER: -1.0
GRASS_VECTOR_DSCO: ''
GRASS_VECTOR_EXPORT_NOCAT: false
GRASS_VECTOR_LCO: ''
inline_points: ''
input:
name: custom/grass7/v_rectify.gml
type: vector
order: 1
points:
name: custom/grass7/v_rectify_local_utm37n.txt
type: file
separator: pipe
results:
output:
name: expected/grass7/v_rectify.gml
type: vector

- algorithm: grass7:v.rectify
name: v.rectify - Use inline_points
params:
'-3': false
-b: false
-o: false
GRASS_MIN_AREA_PARAMETER: 0.0001
GRASS_OUTPUT_TYPE_PARAMETER: 0
GRASS_SNAP_TOLERANCE_PARAMETER: -1.0
GRASS_VECTOR_DSCO: ''
GRASS_VECTOR_EXPORT_NOCAT: false
GRASS_VECTOR_LCO: ''
inline_points: '-637.240 580.860 432843.854 3823560.989 1
-962.079 1086.419 432522.788 3824068.656 1
-1369.031 837.071 432114.226 3823822.337 1
-1877.673 775.273 431605.364 3823764.216 1'
input:
name: custom/grass7/v_rectify.gml
type: vector
order: 1
points:
name: ''
type: file
separator: pipe
results:
output:
name: expected/grass7/v_rectify.gml
type: vector

- algorithm: grass7:v.report
name: v.report - Reports geometry statistics for vector maps
params:
Expand Down

0 comments on commit d234873

Please sign in to comment.