Is there anyone who can explain the difference between ol.proj.getPointResolution()
and ol.sphere.getDistance()
?
I have tested it, and ol.sphere.getDistance()
is a little bit shorter than ol.proj.getPointResolution()
.
In addition, I corrected the lengths by elevations with the Pythagoras.
Below an GPX example file.
Why is with "sphere" shortener? "sphere" calculate with a radius and not the direct distance, logical there must be greater. ??? The same difference exists everywhere on the map, also much further north, eg in Europe.
Only getLength()
: 1322.334212854104
getLength()
with pythagorean()
: 1322.4583239930157
ol.proj.getPointResolution()
: 1322.3120192140298
ol.proj.getPointResolution()
with pythagorean()
: 1322.436132435775
ol.sphere.getDistance()
: 1320.834204523846
ol.sphere.getDistance()
with pythagorean()
: 1320.9584565960345
GPX Example (near equador) from brouter.de
<?xml version="1.0" encoding="UTF-8"?>
<!-- track-length = 1323 filtered ascend = 0 plain-ascend = -1 cost=4036 energy=.0kwh time=9.9m -->
<gpx
xmlns="http://www.topografix.com/GPX/1/1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
creator="BRouter-1.4.11" version="1.1">
<trk>
<name>brouter_trekking_0</name>
<trkseg>
<trkpt lon="11.487967" lat="0.332443"><ele>319.0</ele></trkpt>
<trkpt lon="11.488969" lat="0.332369"><ele>318.0</ele></trkpt>
<trkpt lon="11.494446" lat="0.331905"><ele>309.0</ele></trkpt>
<trkpt lon="11.499806" lat="0.331473"><ele>317.0</ele></trkpt>
</trkseg>
</trk>
</gpx>
Example what i mean:
1) is simple length() between two coords. (longest).
2) the earth is round, but a direct distance is "through" the earth. (shortest).
3) the earth is round and the distance is on the earths surface. (best).
TEST:
Result (single-calculation sum, in meter):
Near Equator short distance (4 points), manually set elevation (350,100,0,300):
brouter (inside GPX file) = 1323
ol.proj.getPointResolution() = 1322.3120192140298
ol.proj.getPointResolution() + pythagorean() = 1563.4324417597672
ol.sphere.getDistance() = 1320.834204523846
ol.sphere.getDistance() + pythagorean() = 1562.1085409935195
distVincenty() = 1322.2532472090315
distVincenty() + pythagorean() = 1563.379164847775
Near Equator long distance, 440 meter elevation range (min,max):
brouter (inside GPX file) = 385356
ol.proj.getPointResolution() = 384026.1115163949
ol.proj.getPointResolution() + pythagorean() = 384353.99178101047
ol.sphere.getDistance() = 383596.9242847851
ol.sphere.getDistance() + pythagorean() = 383925.16964882094
distVincenty() = 383079.99691655475
distVincenty() + pythagorean() = 383408.65056785266
Europe near Pyrenees long distance, 430 meter elevation range (min,max):
brouter (inside GPX file) = 144047
ol.proj.getPointResolution() = 142398.39352352163
ol.proj.getPointResolution() + pythagorean() = 142514.5599121801
ol.sphere.getDistance() = 142239.2492071166
ol.sphere.getDistance() + pythagorean() = 142355.53984053037
distVincenty() = 142463.4265797505
distVincenty() + pythagorean() = 142579.5329685958
Fazit: The joke is, the first was i notice, that the ol.proj.getPointResolution() is shorter than brouter. Than i test ol.sphere.getDistance(), and this was more shorter. Last i test distVincenty(), and this was once shorter and some longer than the other (Equator shorter, Europe longer), but shorter as brouter. Logical would be for me, though the ol.proj.getPointResolution() was the shortest and the distVincenty() was the longest. Does anyone have an explanation for that?