I am working on a school project that tracks the location of someone via an Arduino GPS tracker. The issue I am running into is trying to convert JSON data into GeoJSON data. When the console is opened the error presented is invalid GeoJSON object. I have seen posts here describing the process to convert the data, but due to my rudimentary understanding of coding I am not sure how to implement this conversion into code. The code is based on this: https://github.com/perliedman/leaflet-realtime
index.js
var map = L.map('map');
realtime = L.realtime({
url: 'https://data.sparkfun.com/output/3J0bK7jKYvs6OL6V5zZE.json',
jsonp: 'callback',
cache: true,
crossOrigin: true,
type: 'GET',
},
{
interval: 10 * 1000
}).addTo(map);
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
realtime.on('update', function() {
map.fitBounds(realtime.getBounds(), {maxZoom: 3});
});
The url https://data.sparkfun.com/output/3J0bK7jKYvs6OL6V5zZE.json describes the provided JSON data from my Arduino, but in order for the code to work it seems the data needs to be in GeoJSON format.