mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-30 05:19:57 +00:00
Fix olc-decode and geopoint latitude and longitude order in the geospatial plugin (#8437)
* Reverse latitude and longitude in olc-decode tests to match proper geojson output format * Reverse latitude and longitude in olc-decode to match proper geojson output format * Reverse latitude and longitude in geopoint expected results to match proper geojson format * Reverse latitude and longitude in geolookup expected results to match proper geojson format * Corrected the Oxford to New York distances * Oxford is actually 12 miles closer to New York than Winchester Used calculator at https://www.nhc.noaa.gov/gccalc.shtml to check Reversed latitude and longitude to correct the geojson * Reversed the latitude and longitude turf.point arguments in the geopoint function * Swapped latitude and longitude in geopoint function calls
This commit is contained in:
parent
82bf4480de
commit
bb9c64b38e
@ -16,7 +16,7 @@
|
||||
{"name": "nearest-volcano", "caption": "Nearest Volcano", "type": "string", "display": "[{$:/geospatialdemo/features/harvard-volcanoes-of-the-world}geonearestpoint<coords>]"}
|
||||
],
|
||||
"variables": {
|
||||
"coords": "[<rowTiddler>] :map[geopoint{!!long},{!!lat}]",
|
||||
"census-data": "[<rowTiddler>] :map[geopoint{!!long},{!!lat}geolookup{$:/geospatialdemo/features/canada-census-subdivision-millesime}]"
|
||||
"coords": "[<rowTiddler>] :map[geopoint{!!lat},{!!long}]",
|
||||
"census-data": "[<rowTiddler>] :map[geopoint{!!lat},{!!long}geolookup{$:/geospatialdemo/features/canada-census-subdivision-millesime}]"
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ title: ui/geomarker
|
||||
!! Distance to other markers
|
||||
|
||||
<$let
|
||||
thisLocation={{{ [geopoint{!!long},{!!lat}] }}}
|
||||
thisLocation={{{ [geopoint{!!lat},{!!long}] }}}
|
||||
>
|
||||
<ul>
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/GeoMarker]sort[caption]] -[<currentTiddler>]">
|
||||
@ -81,7 +81,7 @@ title: ui/geomarker
|
||||
<$link><$view field="caption"><$view field="title"/></$view></$link>
|
||||
--
|
||||
<$let
|
||||
otherLocation={{{ [geopoint{!!long},{!!lat}] }}}
|
||||
otherLocation={{{ [geopoint{!!lat},{!!long}] }}}
|
||||
>
|
||||
<$text text={{{ [geodistance<thisLocation>,<otherLocation>,[miles]fixed[0]] }}}/> miles
|
||||
</$let>
|
||||
@ -93,7 +93,7 @@ title: ui/geomarker
|
||||
!! GeoFeature Lookups
|
||||
|
||||
<$let
|
||||
thisLocation={{{ [geopoint{!!long},{!!lat}] }}}
|
||||
thisLocation={{{ [geopoint{!!lat},{!!long}] }}}
|
||||
>
|
||||
<ul>
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/GeoFeature]sort[caption]]">
|
||||
|
@ -18,7 +18,7 @@ exports.geopoint = function(source,operator,options) {
|
||||
var lat = $tw.utils.parseNumber(operator.operands[0] || "0"),
|
||||
long = $tw.utils.parseNumber(operator.operands[1] || "0"),
|
||||
alt = $tw.utils.parseNumber(operator.operands[2] || "0");
|
||||
return [JSON.stringify(turf.point([lat,long,alt]))];
|
||||
return [JSON.stringify(turf.point([long,lat,alt]))];
|
||||
};
|
||||
|
||||
})();
|
||||
|
@ -27,14 +27,14 @@ exports["olc-decode"] = function(source,operator,options) {
|
||||
obj;
|
||||
if(suffixes.indexOf("bounds") !== -1) {
|
||||
obj = turf.polygon([[
|
||||
[olc.latitudeLo, olc.longitudeLo],
|
||||
[olc.latitudeHi, olc.longitudeLo],
|
||||
[olc.latitudeHi, olc.longitudeHi],
|
||||
[olc.latitudeLo, olc.longitudeHi],
|
||||
[olc.latitudeLo, olc.longitudeLo]
|
||||
[olc.longitudeLo, olc.latitudeLo],
|
||||
[olc.longitudeLo, olc.latitudeHi],
|
||||
[olc.longitudeHi, olc.latitudeHi],
|
||||
[olc.longitudeHi, olc.latitudeLo],
|
||||
[olc.longitudeLo, olc.latitudeLo]
|
||||
]]);
|
||||
} else {
|
||||
obj = turf.point([olc.latitudeCenter,olc.longitudeCenter]);
|
||||
obj = turf.point([olc.longitudeCenter,olc.latitudeCenter]);
|
||||
}
|
||||
return [JSON.stringify(obj)];
|
||||
};
|
||||
|
@ -27,4 +27,4 @@ title: Output
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>5042.67688063485,5042.67688063485,8115.401781788412,72.89828683394038,1.2738016908387275,5042.67688063485</p>
|
||||
<p>3406.2115173004354,3406.2115173004354,5481.766068098352,49.241105484826875,0.8604235593111019,3406.2115173004354</p>
|
@ -22,7 +22,7 @@ type: application/json
|
||||
"type": "Feature",
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [102.0,0.5]
|
||||
"coordinates": [0.5,102.0]
|
||||
},
|
||||
"properties": {
|
||||
"animal": "amoeba"
|
||||
@ -33,7 +33,7 @@ type: application/json
|
||||
"geometry": {
|
||||
"type": "LineString",
|
||||
"coordinates": [
|
||||
[102.0,0.0],[103.0,1.0],[104.0,0.0],[105.0,1.0]
|
||||
[0.0,102.0],[1.0,103.0],[0.0,104.0],[1.0,105.0]
|
||||
]
|
||||
},
|
||||
"properties": {
|
||||
@ -46,7 +46,7 @@ type: application/json
|
||||
"geometry": {
|
||||
"type": "Polygon",
|
||||
"coordinates": [
|
||||
[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0]]
|
||||
[[0.0,100.0],[0.0,101.0],[1.0,101.0],[1.0,100.0],[0.0,100.0]]
|
||||
]
|
||||
},
|
||||
"properties": {
|
||||
|
@ -17,7 +17,7 @@ title: Output
|
||||
>
|
||||
|
||||
<$text text={{{ =[<oxford>] =[<winchester>] +[geonearestpoint<new-york>jsonget[id]] }}}/>,
|
||||
<$text text={{{ =[<oxford>] =[[Not a point]] +[geonearestpoint<new-york>jsonget[id]] }}}/>,
|
||||
<$text text={{{ =[<winchester>] =[[Not a point]] +[geonearestpoint<new-york>jsonget[id]] }}}/>,
|
||||
<$text text={{{ =[[Not a point]] +[geonearestpoint<new-york>jsonget[id]] }}}/>
|
||||
|
||||
</$let>
|
||||
@ -25,4 +25,4 @@ title: Output
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Winchester,Oxford,</p>
|
||||
<p>Oxford,Winchester,</p>
|
@ -22,14 +22,14 @@ title: Output
|
||||
"id": "Oxford",
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [51.751944, -1.257778]
|
||||
"coordinates": [-1.257778, 51.751944]
|
||||
}
|
||||
},{
|
||||
"type": "Feature",
|
||||
"id": "Winchester",
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [51.0632, -1.308]
|
||||
"coordinates": [-1.308, 51.0632]
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -42,4 +42,4 @@ title: Output
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Winchester</p>
|
||||
<p>Oxford</p>
|
@ -18,4 +18,4 @@ title: Output
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[51.751944,-1.257778,0]}}{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[51.751944,-1.257778,0]},"id":"Oxford"}{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[51.751944,-1.257778,2]}}
|
||||
{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[-1.257778,51.751944,0]}}{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[-1.257778,51.751944,0]},"id":"Oxford"}{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[-1.257778,51.751944,2]}}
|
@ -15,6 +15,6 @@ title: Output
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>({"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[51.751875,-1.257875],[51.752,-1.257875],[51.752,-1.25775],[51.751875,-1.25775],[51.751875,-1.257875]]]}})
|
||||
({"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[51.7519375,-1.257765625]}})
|
||||
<p>({"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[-1.257875,51.751875],[-1.257875,51.752],[-1.25775,51.752],[-1.25775,51.751875],[-1.257875,51.751875]]]}})
|
||||
({"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[-1.257765625,51.7519375]}})
|
||||
</p>
|
Loading…
Reference in New Issue
Block a user