Skip to content

Commit

Permalink
Also store x/y coordinates of nearest points on features when calcula…
Browse files Browse the repository at this point in the history
…ting

nearest features

This can be useful, and is difficult to calculate later!
  • Loading branch information
nyalldawson committed Apr 2, 2019
1 parent 95af4d4 commit 59ed078
Show file tree
Hide file tree
Showing 19 changed files with 624 additions and 137 deletions.
Expand Up @@ -16,15 +16,23 @@
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>1,1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:fid_2>lines.2</ogr:fid_2>
<ogr:n>1</ogr:n>
<ogr:distance>0.915920625957996</ogr:distance>
<ogr:distance>0.915920625957997</ogr:distance>
<ogr:feature_x>1</ogr:feature_x>
<ogr:feature_y>1</ogr:feature_y>
<ogr:nearest_x>1.91292520517715</ogr:nearest_x>
<ogr:nearest_y>1.07401461212186</ogr:nearest_y>
</ogr:join_points_to_layers_discard>
</gml:featureMember>
<gml:featureMember>
<ogr:join_points_to_layers_discard fid="points.1">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>3.13409350057012,2.74139110604333</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:fid_2>lines.2</ogr:fid_2>
<ogr:n>1</ogr:n>
<ogr:distance>0.860133820101952</ogr:distance>
<ogr:distance>0.860133820101953</ogr:distance>
<ogr:feature_x>3.13409350057012</ogr:feature_x>
<ogr:feature_y>2.74139110604333</ogr:feature_y>
<ogr:nearest_x>2.91690483120036</ogr:nearest_x>
<ogr:nearest_y>1.90912956639334</ogr:nearest_y>
</ogr:join_points_to_layers_discard>
</gml:featureMember>
<gml:featureMember>
Expand All @@ -33,6 +41,10 @@
<ogr:fid_2>lines.2</ogr:fid_2>
<ogr:n>1</ogr:n>
<ogr:distance>0.117399851996412</ogr:distance>
<ogr:feature_x>2</ogr:feature_x>
<ogr:feature_y>2</ogr:feature_y>
<ogr:nearest_x>2.01378272524878</ogr:nearest_x>
<ogr:nearest_y>2.11658799995495</ogr:nearest_y>
</ogr:join_points_to_layers_discard>
</gml:featureMember>
<gml:featureMember>
Expand All @@ -41,6 +53,10 @@
<ogr:fid_2>lines.2</ogr:fid_2>
<ogr:n>1</ogr:n>
<ogr:distance>0.945227772283215</ogr:distance>
<ogr:feature_x>3.68392246294185</ogr:feature_x>
<ogr:feature_y>0.961687571265678</ogr:feature_y>
<ogr:nearest_x>3.27743119266055</ogr:nearest_x>
<ogr:nearest_y>1.81504587155963</ogr:nearest_y>
</ogr:join_points_to_layers_discard>
</gml:featureMember>
<gml:featureMember>
Expand All @@ -49,6 +65,10 @@
<ogr:fid_2>lines.5</ogr:fid_2>
<ogr:n>1</ogr:n>
<ogr:distance>0.620215569426356</ogr:distance>
<ogr:feature_x>7.18198403648803</ogr:feature_x>
<ogr:feature_y>-1.26818700114025</ogr:feature_y>
<ogr:nearest_x>7.51395373866132</ogr:nearest_x>
<ogr:nearest_y>-1.79207961360757</ogr:nearest_y>
</ogr:join_points_to_layers_discard>
</gml:featureMember>
<gml:featureMember>
Expand All @@ -57,6 +77,10 @@
<ogr:fid_2>lines.1</ogr:fid_2>
<ogr:n>1</ogr:n>
<ogr:distance>0.210718358038768</ogr:distance>
<ogr:feature_x>0.220296465222349</ogr:feature_x>
<ogr:feature_y>-1.21071835803877</ogr:feature_y>
<ogr:nearest_x>0.220296465222349</ogr:nearest_x>
<ogr:nearest_y>-1</ogr:nearest_y>
</ogr:join_points_to_layers_discard>
</gml:featureMember>
</ogr:FeatureCollection>
Expand Up @@ -36,6 +36,30 @@
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="feature_x" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="feature_y" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="nearest_x" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="nearest_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>
Expand Down
Expand Up @@ -17,6 +17,10 @@
<ogr:fid_2>points.2</ogr:fid_2>
<ogr:n>1</ogr:n>
<ogr:distance>1.4142135623731</ogr:distance>
<ogr:feature_x>1</ogr:feature_x>
<ogr:feature_y>1</ogr:feature_y>
<ogr:nearest_x>2</ogr:nearest_x>
<ogr:nearest_y>2</ogr:nearest_y>
</ogr:join_to_nearest_self>
</gml:featureMember>
<gml:featureMember>
Expand All @@ -25,6 +29,10 @@
<ogr:fid_2>points.2</ogr:fid_2>
<ogr:n>1</ogr:n>
<ogr:distance>1.3549276143601</ogr:distance>
<ogr:feature_x>3.13409350057012</ogr:feature_x>
<ogr:feature_y>2.74139110604333</ogr:feature_y>
<ogr:nearest_x>2</ogr:nearest_x>
<ogr:nearest_y>2</ogr:nearest_y>
</ogr:join_to_nearest_self>
</gml:featureMember>
<gml:featureMember>
Expand All @@ -33,6 +41,10 @@
<ogr:fid_2>points.1</ogr:fid_2>
<ogr:n>1</ogr:n>
<ogr:distance>1.3549276143601</ogr:distance>
<ogr:feature_x>2</ogr:feature_x>
<ogr:feature_y>2</ogr:feature_y>
<ogr:nearest_x>3.13409350057012</ogr:nearest_x>
<ogr:nearest_y>2.74139110604333</ogr:nearest_y>
</ogr:join_to_nearest_self>
</gml:featureMember>
<gml:featureMember>
Expand All @@ -41,6 +53,10 @@
<ogr:fid_2>points.4</ogr:fid_2>
<ogr:n>1</ogr:n>
<ogr:distance>1.69120460054011</ogr:distance>
<ogr:feature_x>5.25860889395667</ogr:feature_x>
<ogr:feature_y>1.57856328392246</ogr:feature_y>
<ogr:nearest_x>3.68392246294185</ogr:nearest_x>
<ogr:nearest_y>0.961687571265678</ogr:nearest_y>
</ogr:join_to_nearest_self>
</gml:featureMember>
<gml:featureMember>
Expand All @@ -49,6 +65,10 @@
<ogr:fid_2>points.3</ogr:fid_2>
<ogr:n>1</ogr:n>
<ogr:distance>1.69120460054011</ogr:distance>
<ogr:feature_x>3.68392246294185</ogr:feature_x>
<ogr:feature_y>0.961687571265678</ogr:feature_y>
<ogr:nearest_x>5.25860889395667</ogr:nearest_x>
<ogr:nearest_y>1.57856328392246</ogr:nearest_y>
</ogr:join_to_nearest_self>
</gml:featureMember>
<gml:featureMember>
Expand All @@ -57,6 +77,10 @@
<ogr:fid_2>points.8</ogr:fid_2>
<ogr:n>1</ogr:n>
<ogr:distance>3.61692644124198</ogr:distance>
<ogr:feature_x>0.201140250855188</ogr:feature_x>
<ogr:feature_y>-4.82759407069555</ogr:feature_y>
<ogr:nearest_x>0.220296465222349</ogr:nearest_x>
<ogr:nearest_y>-1.21071835803877</ogr:nearest_y>
</ogr:join_to_nearest_self>
</gml:featureMember>
<gml:featureMember>
Expand All @@ -65,6 +89,10 @@
<ogr:fid_2>points.7</ogr:fid_2>
<ogr:n>1</ogr:n>
<ogr:distance>2.03648094068824</ogr:distance>
<ogr:feature_x>7.97126567844926</ogr:feature_x>
<ogr:feature_y>0.609122006841505</ogr:feature_y>
<ogr:nearest_x>7.18198403648803</ogr:nearest_x>
<ogr:nearest_y>-1.26818700114025</ogr:nearest_y>
</ogr:join_to_nearest_self>
</gml:featureMember>
<gml:featureMember>
Expand All @@ -73,6 +101,10 @@
<ogr:fid_2>points.6</ogr:fid_2>
<ogr:n>1</ogr:n>
<ogr:distance>2.03648094068824</ogr:distance>
<ogr:feature_x>7.18198403648803</ogr:feature_x>
<ogr:feature_y>-1.26818700114025</ogr:feature_y>
<ogr:nearest_x>7.97126567844926</ogr:nearest_x>
<ogr:nearest_y>0.609122006841505</ogr:nearest_y>
</ogr:join_to_nearest_self>
</gml:featureMember>
<gml:featureMember>
Expand All @@ -81,6 +113,10 @@
<ogr:fid_2>points.0</ogr:fid_2>
<ogr:n>1</ogr:n>
<ogr:distance>2.34418712152302</ogr:distance>
<ogr:feature_x>0.220296465222349</ogr:feature_x>
<ogr:feature_y>-1.21071835803877</ogr:feature_y>
<ogr:nearest_x>1</ogr:nearest_x>
<ogr:nearest_y>1</ogr:nearest_y>
</ogr:join_to_nearest_self>
</gml:featureMember>
</ogr:FeatureCollection>
Expand Up @@ -36,6 +36,30 @@
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="feature_x" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="feature_y" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="nearest_x" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="nearest_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>
Expand Down

0 comments on commit 59ed078

Please sign in to comment.