GPS lat,long for Tracker One Device [SOLVED]

I need to get GPS lat, long from my Tracker One device. I have tried a couple of libraries like AssetTracker, TinyGPS++ but was not able to publish, or even when did was of (0.0000,0.0000)
Here is a snippet of my code, where i am getting temp data using thermister lib.
Looking for help on how to get lat/long here
Thank You!

void createEventPayload(double temp, float lat, float lon)
 JsonWriterStatic<256> jw;
   JsonWriterAutoObject obj(&jw);
        float lat = 39.73915360;
	float lng = -104.98470340;

   jw.insertKeyValue("temp", temp);
   jw.insertKeyValue("lon", lon);
   jw.insertKeyValue("lat", lat);
 Particle.publish("getData", jw.getBuffer(), PRIVATE);

Have you had a look at the Tracker One Edge firmware?
This already acquire the coordinates and publishes them by default.

And here you can find some tutorial

Yes, i have seen this firmware code, it did not compile for me, maybe I am not using the correct library import. Also wanted to add, how do we publish the output “loc” event using Particle.publish();

I get this error while compiling from Workbench

Particle/tracker-edge/".  Stop.
make[2]: *** [../../../build/ user] Error 2
make[1]: *** [../build/ modules/tracker/user-part] Error 2

Hi Sabi,
a couple of days ago I was able to compile it using Workbench, like this (below).
Would you like to try again?


This application must be built with device OS version 2.0.0-rc.3 and above.

  1. Clone this repository $ git clone && cd ./tracker-edge
  2. Init & Update Submodules $ git submodule update --init --recursive
  3. Open Particle Workbench
  4. Run the Particle: Import Project command, follow the prompts, and wait for the project to load
  5. Run the Particle: Configure Workspace for Device command and select a compatible Device OS version and the tracker platform when prompted (docs)
  6. Connect your device
  7. Compile & Flash!


Another source:


Thanks Gustavo, But i get a compile error (shown above). Is it possible to run the same from WebIDE? If so, which library do I need to import? I am following this code, which i also need to publish to an event (Webhook)

Do you have a space in a directory name? That will cause builds to fail in Workbench. Not just the directory that the source is contained in, but also any directory above that.

1 Like

There was an announcement regarding that here:

But I would check the folder space that Rick mentioned in the post above :arrow_up:

1 Like

Thanks @rickkas7 , directory name above did have space.

Thanks @gusgonnet , to fasten the process now, I just flashed version 11 binary from CLI. I am getting the data, but it doesn’t have lat/long (maybe i will flash version 10 bin back)
Also can you please help me on how to publish to an event? I believe I’ll need to modify the main.cpp file ?

"lck":0 means the GNSS (GPS) does not have a lock yet; the GNSS LED is not yet solid blue.

Make sure the Tracker One is facing up, that is to say the LEDs face up, and you may need to adjust the positioning for a better view of the sky, for example in a window.

1 Like

Yes Thanks @rickkas7, I am getting proper Data now.

Can you please guide me on how do I publish this to an event now? Instead of using SerialLogHandler, I would like to publish data to an event (my webhook is already in place).
Eg: Particle.publish("data",loc,60,PRIVATE);

Is there any document on how to cloud compile version 11 ?

You are showing the console output which means your device is already pblishing the data.
Why not just catch that stock event?

BTW, have you read through the tutorial linked twice in this thread already?
The solution can be found there :wink:

And also here
Particularly this part

1 Like

Perfect!! Why did I not think of renaming my webhook event!
I now have the data where its suppose to be!

Thanks a ton :smile: