mirror of
https://github.com/TiddlyWiki/TiddlyWiki5.git
synced 2026-05-01 15:47:00 +00:00
First commit
This is the beginnings of a new core plugin to add geospatial capabilities, building on the JSON operators that we now have in the core. It uses the libraries leaflet.js for mapping and turf.js for geospatial calculations.
This commit is contained in:
24
plugins/tiddlywiki/geospatial/operators/helper.js
Normal file
24
plugins/tiddlywiki/geospatial/operators/helper.js
Normal file
@@ -0,0 +1,24 @@
|
||||
/*\
|
||||
title: $:/plugins/tiddlywiki/geospatial/operators/helper.js
|
||||
type: application/javascript
|
||||
module-type: filteroperator
|
||||
|
||||
Filter operators for geospatial helpers
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var turf = require("$:/plugins/tiddlywiki/geospatial/turf.js");
|
||||
|
||||
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]))];
|
||||
};
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user