-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port Hub Distance (lines) to new API
Improvements: - handle different CRS between points and hubs - add unit test
- Loading branch information
1 parent
fc1746e
commit e035445
Showing
6 changed files
with
205 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
python/plugins/processing/tests/testdata/expected/hub_distance_lines.gfs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<GMLFeatureClassList> | ||
<GMLFeatureClass> | ||
<Name>hub_distance_lines</Name> | ||
<ElementPath>hub_distance_lines</ElementPath> | ||
<!--LINESTRING--> | ||
<GeometryType>2</GeometryType> | ||
<SRSName>EPSG:4326</SRSName> | ||
<DatasetSpecificInfo> | ||
<FeatureCount>9</FeatureCount> | ||
<ExtentXMin>0.00000</ExtentXMin> | ||
<ExtentXMax>8.00000</ExtentXMax> | ||
<ExtentYMin>-5.00000</ExtentYMin> | ||
<ExtentYMax>3.00000</ExtentYMax> | ||
</DatasetSpecificInfo> | ||
<PropertyDefn> | ||
<Name>id</Name> | ||
<ElementPath>id</ElementPath> | ||
<Type>Integer</Type> | ||
</PropertyDefn> | ||
<PropertyDefn> | ||
<Name>id2</Name> | ||
<ElementPath>id2</ElementPath> | ||
<Type>Integer</Type> | ||
</PropertyDefn> | ||
<PropertyDefn> | ||
<Name>HubName</Name> | ||
<ElementPath>HubName</ElementPath> | ||
<Type>String</Type> | ||
<Width>6</Width> | ||
</PropertyDefn> | ||
<PropertyDefn> | ||
<Name>HubDist</Name> | ||
<ElementPath>HubDist</ElementPath> | ||
<Type>Real</Type> | ||
</PropertyDefn> | ||
</GMLFeatureClass> | ||
</GMLFeatureClassList> |
95 changes: 95 additions & 0 deletions
95
python/plugins/processing/tests/testdata/expected/hub_distance_lines.gml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ogr:FeatureCollection | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="" | ||
xmlns:ogr="http://ogr.maptools.org/" | ||
xmlns:gml="http://www.opengis.net/gml"> | ||
<gml:boundedBy> | ||
<gml:Box> | ||
<gml:coord><gml:X>0</gml:X><gml:Y>-5</gml:Y></gml:coord> | ||
<gml:coord><gml:X>8</gml:X><gml:Y>3</gml:Y></gml:coord> | ||
</gml:Box> | ||
</gml:boundedBy> | ||
|
||
<gml:featureMember> | ||
<ogr:hub_distance_lines fid="points.0"> | ||
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>1,1 1.34480766269365,-1.25946718408328</gml:coordinates></gml:LineString></ogr:geometryProperty> | ||
<ogr:id>1</ogr:id> | ||
<ogr:id2>2</ogr:id2> | ||
<ogr:HubName>point1</ogr:HubName> | ||
<ogr:HubDist>254434.675423572</ogr:HubDist> | ||
</ogr:hub_distance_lines> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:hub_distance_lines fid="points.1"> | ||
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>3,3 3.12290985247467,2.27221164803351</gml:coordinates></gml:LineString></ogr:geometryProperty> | ||
<ogr:id>2</ogr:id> | ||
<ogr:id2>1</ogr:id2> | ||
<ogr:HubName>point3</ogr:HubName> | ||
<ogr:HubDist>82164.2455422206</ogr:HubDist> | ||
</ogr:hub_distance_lines> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:hub_distance_lines fid="points.2"> | ||
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>2,2 3.12290985247467,2.27221164803351</gml:coordinates></gml:LineString></ogr:geometryProperty> | ||
<ogr:id>3</ogr:id> | ||
<ogr:id2>0</ogr:id2> | ||
<ogr:HubName>point3</ogr:HubName> | ||
<ogr:HubDist>128622.227687308</ogr:HubDist> | ||
</ogr:hub_distance_lines> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:hub_distance_lines fid="points.3"> | ||
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>5,2 3.12290985247467,2.27221164803351</gml:coordinates></gml:LineString></ogr:geometryProperty> | ||
<ogr:id>4</ogr:id> | ||
<ogr:id2>2</ogr:id2> | ||
<ogr:HubName>point3</ogr:HubName> | ||
<ogr:HubDist>211142.486929284</ogr:HubDist> | ||
</ogr:hub_distance_lines> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:hub_distance_lines fid="points.4"> | ||
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>4,1 3.12290985247467,2.27221164803351</gml:coordinates></gml:LineString></ogr:geometryProperty> | ||
<ogr:id>5</ogr:id> | ||
<ogr:id2>1</ogr:id2> | ||
<ogr:HubName>point3</ogr:HubName> | ||
<ogr:HubDist>172016.876891364</ogr:HubDist> | ||
</ogr:hub_distance_lines> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:hub_distance_lines fid="points.5"> | ||
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>0,-5 1.34480766269365,-1.25946718408328</gml:coordinates></gml:LineString></ogr:geometryProperty> | ||
<ogr:id>6</ogr:id> | ||
<ogr:id2>0</ogr:id2> | ||
<ogr:HubName>point1</ogr:HubName> | ||
<ogr:HubDist>442487.532089586</ogr:HubDist> | ||
</ogr:hub_distance_lines> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:hub_distance_lines fid="points.6"> | ||
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>8,-1 6.29896824663525,0.138489020296281</gml:coordinates></gml:LineString></ogr:geometryProperty> | ||
<ogr:id>7</ogr:id> | ||
<ogr:id2>0</ogr:id2> | ||
<ogr:HubName>point2</ogr:HubName> | ||
<ogr:HubDist>227856.24000978</ogr:HubDist> | ||
</ogr:hub_distance_lines> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:hub_distance_lines fid="points.7"> | ||
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>7,-1 6.29896824663525,0.138489020296281</gml:coordinates></gml:LineString></ogr:geometryProperty> | ||
<ogr:id>8</ogr:id> | ||
<ogr:id2>0</ogr:id2> | ||
<ogr:HubName>point2</ogr:HubName> | ||
<ogr:HubDist>148835.564980152</ogr:HubDist> | ||
</ogr:hub_distance_lines> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:hub_distance_lines fid="points.8"> | ||
<ogr:geometryProperty><gml:LineString srsName="EPSG:4326"><gml:coordinates>0,-1 1.34480766269365,-1.25946718408328</gml:coordinates></gml:LineString></ogr:geometryProperty> | ||
<ogr:id>9</ogr:id> | ||
<ogr:id2>0</ogr:id2> | ||
<ogr:HubName>point1</ogr:HubName> | ||
<ogr:HubDist>152464.26003518</ogr:HubDist> | ||
</ogr:hub_distance_lines> | ||
</gml:featureMember> | ||
</ogr:FeatureCollection> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters