Hello,
I'm trying to use an external javasript library (https://github.com/manuelbieh/Geolib) within the javascript that is called from the XML Dashboard.
code of javascript included directly in XML dashboard:
var polygon2 = [
{"latitude": 51.513357512, "longitude": 7.45574331, "elevation":523.92},
{"latitude": 51.515400598, "longitude": 7.45518541, "elevation":524.54},
];
require(['Geolib-master/src/geolib'], function($){
box = geolib.getCenterOfBounds(polygon2);
alert ("center Lat: " + box.latitude + "Lon: "+box.longitude );
});
I get the error: ReferenceError: Can't find variable: geolib
the geolib.js file is stored in the path Splunk/share/splunk/search_mrsparkle/exposed/js/Geolib-master/src
Thank you in advance for your help!
I tried different things, and this finally worked out for me:
1. copied the geolib.js file to Splunk/share/splunk/search_mrsparkle/exposed/js
2. changed the code from: require(['Geolib-master/src/geolib'], function($){
to: require(['geolib'], function(geolib){
I don't fully understand, but it is working 🙂
I tried different things, and this finally worked out for me:
1. copied the geolib.js file to Splunk/share/splunk/search_mrsparkle/exposed/js
2. changed the code from: require(['Geolib-master/src/geolib'], function($){
to: require(['geolib'], function(geolib){
I don't fully understand, but it is working 🙂