mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-10 20:09: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>]"}
|
{"name": "nearest-volcano", "caption": "Nearest Volcano", "type": "string", "display": "[{$:/geospatialdemo/features/harvard-volcanoes-of-the-world}geonearestpoint<coords>]"}
|
||||||
],
|
],
|
||||||
"variables": {
|
"variables": {
|
||||||
"coords": "[<rowTiddler>] :map[geopoint{!!long},{!!lat}]",
|
"coords": "[<rowTiddler>] :map[geopoint{!!lat},{!!long}]",
|
||||||
"census-data": "[<rowTiddler>] :map[geopoint{!!long},{!!lat}geolookup{$:/geospatialdemo/features/canada-census-subdivision-millesime}]"
|
"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
|
!! Distance to other markers
|
||||||
|
|
||||||
<$let
|
<$let
|
||||||
thisLocation={{{ [geopoint{!!long},{!!lat}] }}}
|
thisLocation={{{ [geopoint{!!lat},{!!long}] }}}
|
||||||
>
|
>
|
||||||
<ul>
|
<ul>
|
||||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/GeoMarker]sort[caption]] -[<currentTiddler>]">
|
<$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>
|
<$link><$view field="caption"><$view field="title"/></$view></$link>
|
||||||
--
|
--
|
||||||
<$let
|
<$let
|
||||||
otherLocation={{{ [geopoint{!!long},{!!lat}] }}}
|
otherLocation={{{ [geopoint{!!lat},{!!long}] }}}
|
||||||
>
|
>
|
||||||
<$text text={{{ [geodistance<thisLocation>,<otherLocation>,[miles]fixed[0]] }}}/> miles
|
<$text text={{{ [geodistance<thisLocation>,<otherLocation>,[miles]fixed[0]] }}}/> miles
|
||||||
</$let>
|
</$let>
|
||||||
@ -93,7 +93,7 @@ title: ui/geomarker
|
|||||||
!! GeoFeature Lookups
|
!! GeoFeature Lookups
|
||||||
|
|
||||||
<$let
|
<$let
|
||||||
thisLocation={{{ [geopoint{!!long},{!!lat}] }}}
|
thisLocation={{{ [geopoint{!!lat},{!!long}] }}}
|
||||||
>
|
>
|
||||||
<ul>
|
<ul>
|
||||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/GeoFeature]sort[caption]]">
|
<$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"),
|
var lat = $tw.utils.parseNumber(operator.operands[0] || "0"),
|
||||||
long = $tw.utils.parseNumber(operator.operands[1] || "0"),
|
long = $tw.utils.parseNumber(operator.operands[1] || "0"),
|
||||||
alt = $tw.utils.parseNumber(operator.operands[2] || "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;
|
obj;
|
||||||
if(suffixes.indexOf("bounds") !== -1) {
|
if(suffixes.indexOf("bounds") !== -1) {
|
||||||
obj = turf.polygon([[
|
obj = turf.polygon([[
|
||||||
[olc.latitudeLo, olc.longitudeLo],
|
[olc.longitudeLo, olc.latitudeLo],
|
||||||
[olc.latitudeHi, olc.longitudeLo],
|
[olc.longitudeLo, olc.latitudeHi],
|
||||||
[olc.latitudeHi, olc.longitudeHi],
|
[olc.longitudeHi, olc.latitudeHi],
|
||||||
[olc.latitudeLo, olc.longitudeHi],
|
[olc.longitudeHi, olc.latitudeLo],
|
||||||
[olc.latitudeLo, olc.longitudeLo]
|
[olc.longitudeLo, olc.latitudeLo]
|
||||||
]]);
|
]]);
|
||||||
} else {
|
} else {
|
||||||
obj = turf.point([olc.latitudeCenter,olc.longitudeCenter]);
|
obj = turf.point([olc.longitudeCenter,olc.latitudeCenter]);
|
||||||
}
|
}
|
||||||
return [JSON.stringify(obj)];
|
return [JSON.stringify(obj)];
|
||||||
};
|
};
|
||||||
|
@ -27,4 +27,4 @@ title: Output
|
|||||||
+
|
+
|
||||||
title: ExpectedResult
|
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",
|
"type": "Feature",
|
||||||
"geometry": {
|
"geometry": {
|
||||||
"type": "Point",
|
"type": "Point",
|
||||||
"coordinates": [102.0,0.5]
|
"coordinates": [0.5,102.0]
|
||||||
},
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
"animal": "amoeba"
|
"animal": "amoeba"
|
||||||
@ -33,7 +33,7 @@ type: application/json
|
|||||||
"geometry": {
|
"geometry": {
|
||||||
"type": "LineString",
|
"type": "LineString",
|
||||||
"coordinates": [
|
"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": {
|
"properties": {
|
||||||
@ -46,7 +46,7 @@ type: application/json
|
|||||||
"geometry": {
|
"geometry": {
|
||||||
"type": "Polygon",
|
"type": "Polygon",
|
||||||
"coordinates": [
|
"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": {
|
"properties": {
|
||||||
|
@ -17,7 +17,7 @@ title: Output
|
|||||||
>
|
>
|
||||||
|
|
||||||
<$text text={{{ =[<oxford>] =[<winchester>] +[geonearestpoint<new-york>jsonget[id]] }}}/>,
|
<$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]] }}}/>
|
<$text text={{{ =[[Not a point]] +[geonearestpoint<new-york>jsonget[id]] }}}/>
|
||||||
|
|
||||||
</$let>
|
</$let>
|
||||||
@ -25,4 +25,4 @@ title: Output
|
|||||||
+
|
+
|
||||||
title: ExpectedResult
|
title: ExpectedResult
|
||||||
|
|
||||||
<p>Winchester,Oxford,</p>
|
<p>Oxford,Winchester,</p>
|
@ -22,14 +22,14 @@ title: Output
|
|||||||
"id": "Oxford",
|
"id": "Oxford",
|
||||||
"geometry": {
|
"geometry": {
|
||||||
"type": "Point",
|
"type": "Point",
|
||||||
"coordinates": [51.751944, -1.257778]
|
"coordinates": [-1.257778, 51.751944]
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
"type": "Feature",
|
"type": "Feature",
|
||||||
"id": "Winchester",
|
"id": "Winchester",
|
||||||
"geometry": {
|
"geometry": {
|
||||||
"type": "Point",
|
"type": "Point",
|
||||||
"coordinates": [51.0632, -1.308]
|
"coordinates": [-1.308, 51.0632]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -42,4 +42,4 @@ title: Output
|
|||||||
+
|
+
|
||||||
title: ExpectedResult
|
title: ExpectedResult
|
||||||
|
|
||||||
<p>Winchester</p>
|
<p>Oxford</p>
|
@ -18,4 +18,4 @@ title: Output
|
|||||||
+
|
+
|
||||||
title: ExpectedResult
|
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
|
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]]]}})
|
<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":[51.7519375,-1.257765625]}})
|
({"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[-1.257765625,51.7519375]}})
|
||||||
</p>
|
</p>
|
Loading…
Reference in New Issue
Block a user