Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var jsonData = "./data/tracking.json";
- var outGeoJson = {}
- outGeoJson['properties'] = jsonData
- outGeoJson['type']= "Feature"
- outGeoJson['geometry']= {"type": "Point", "coordinates":
- [jsonData['lat'], jsonData['lon']]}
- console.log(outGeoJson)
- var geojson = {
- type: "FeatureCollection",
- features: [],
- };
- for (i = 0; i < jsonData.positions.length; i++) {
- if (window.CP.shouldStopExecution(1)) {
- break;
- }
- geojson.features.push({
- "type": "Feature",
- "geometry": {
- "type": "Point",
- "coordinates": [jsonData.positions[i].longitude, jsonData.positions[i].latitude]
- },
- "properties": {
- "report_at": jsonData.positions[i].report_at,
- "lat": jsonData.positions[i].lat,
- "lon": jsonData.positions[i].lon,
- "dir": jsonData.positions[i].dir,
- "first": jsonData.positions[i].first,
- "last": jsonData.positions[i].last
- }
- });
- }
- window.CP.exitedLoop(1);
- console.log(geojson)
- {
- "positions": [
- {
- "report_at": "2015-01-21 21:00:08",
- "lat": "38.9080658",
- "lon": "-77.0030365",
- "elev": "0",
- "dir": "0",
- "gps": "0",
- "callsign": "WX2DX",
- "email": "",
- "phone": "",
- "ham": "WX2DX",
- "ham_show": "0",
- "freq": "",
- "note": "",
- "im": "",
- "twitter": null,
- "web": "",
- "unix": "1421874008",
- "first": "William",
- "last": "Smith",
- "marker": "36181"
- }
- ]
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement