GPS data to Google Earth

I’m looking for a recommendation for a method of getting GPS traker data to Google earth - where when I’m logged in I can see all of my assettracker devices. also - change the color of the push pin or other icon - Green, yellow, orange, red depending how long the device has be away from home.

1 Like

Not sure if you have seen this or not.

@gusgonnet Is on this forum, the guy who wrote this tutorial :slight_smile:

1 Like

I tried this - thanks for the link. I’m having some problems compiling it - my Ubobots token isn’t getting defined correctly - I’m sure this is a simple noob mistake. This is my first project in this platform.

Could someone help by looking at this my ubibots token isn’t being recognized and I I commented in the code from Ubi that I need to put in place of the example.

// NOTE: localData.h should contain the ubidots token in this form:
// This value comes from ubidots -> menu -> API keys -> Authentication token
// #define UBIDOTS_TOKEN "skljfhsakldjdfh29841283840922324"
// Alternatively, do not create localData.h, remove line 8 below
// and define UBIDOTS_TOKEN in the current file
// #include "localData.h"

/*******************************************************************************
ubidots variables

webhook definition:
Event name: ubidotsLatLong
url: https://things.ubidots.com/api/v1.6/devices/{{ubi-dsl-vl}}/values/?token={{ubi-token}}
Request type: POST
Device: Any
Advanced settings:
Send custom data: JSON
and then enter:

{
  "value": "{{ubi-value}}",
  "context": {
    "lat": " {{google-lat}}",
    "lng": "{{google-lng}}"
  }
}
include default data: no
enforce ssl: yes
*******************************************************************************/
// This value comes from ubidots

const String ubidotsToken = UBIDOTS_TOKEN;
// const String ubidotsToken = 5cputmyubitoken here;
#define UBIDOTS_TOKEN "5Iputmyubitoken here"

GoogleMapsDeviceLocator locator;

#define APP_NAME "googleMaps"
String VERSION = "Version 0.01";
/*******************************************************************************

changes in version 0.01:
* Initial version
*******************************************************************************/
SYSTEM_MODE(AUTOMATIC);

void setup()
{
Particle.publish(APP_NAME, VERSION, PRIVATE);

// Scan for visible networks and publish to the cloud every 30 seconds
// Pass the returned location to be handled by the locationCallback() method
locator.withSubscribe(locationCallback).withLocatePeriodic(60);
}
/***

void loop() {
// Get some data
String data = String(10);
// Trigger the integration
Particle.publish("ubidotsLatLong", data, PRIVATE);
// Wait 60 seconds
delay(60000);
}
**/

/*
void setup() {
// Subscribe to the integration response event
Particle.subscribe("hook-response/ubidotsLatLong", myHandler, MY_DEVICES);
}

void myHandler(const char event, const char data) {
// Handle the integration response
}/

void loop() {
locator.loop();
}

void locationCallback(float lat, float lon, float accuracy) {
// Handle the returned location data for the device. This method is passed three arguments:
// - Latitude
// - Longitude
// - Accuracy of estimated location (in meters)

String name = "geo";
String value = "1"; //dummy value

Particle.publish("ubidotsLatLong", "{"ubi-dsl-vl":"" + Particle.deviceID() + "/" + name + "", "ubi-token":"" + ubidotsToken + "", "ubi-value":"" + value + "" , "google-lat":"" + lat + "" , "google-lng":"" + lon + ""}", 60, PRIVATE);
}

The order of these two commands doesn't make sense IMO

You are using UBIDOTS_TOKEN before you actually define it. Try swapping that round.

BTW, the const in const String ubidotsToken doesn't really do what one might think, so you can just leave it out.

One of the things that needs to keep in mind about Ubidots is that the EDU side is no longer updated as the industrial side is. All their new libraries and documents don’t actually work for the EDU. I have talked to them. Regarding this and they said it’s a business … As tho EDU side is free. Well it’s only free for 4500 credit tokens they give then one must pay … Sign up for free industrial side trial. It’s a world of difference as far as documents… essentially they have two different platforms and only one is current

1 Like

You can also get a free Losant account and push GPS data to that and display location on their Map interface. Or maybe integrate it with Google Earth.

1 Like