Web.Get location data issue

I’m having an issue with a Web.Get Route. I am using a separate GPS module so that I may keep a continuous cellular connection and log location quickly when necessary. The location data coming from the separate GPS module is correct.

My problem is that when data is logged to _web.qo from the Web.Get Route, the location data in the JSON is incorrect. The location in the body is correct because it is coming from the GPS module. It is almost as if it is seeing the last GPS location from the notecard gps that I used before switching to the separate module (just a wild guess).

I’m probably not doing this correctly, but……here is the Web.Get Route info…..

Here is the URL (removed the HTTPS:// to keep it from making it a link:

I have the body nested inside the body is because [.body.xxxx] was returning a null string, so I threw everything at the wall to see what would stick…and this worked (different issue, possibly).

“ny3.blynk.cloud/external/api/logEvent?token=[token]&code=vehicle_motion&description=[.body.body.vehicle]%20is%20[.body.body.motion]%0D%0ATracking%20Enabled:%20[.body.body.tracking_enabled]%0D%0A%0D%0A[.body.body.local_time]%20Location:%0D%0A[.body.body.location_url]“

And the JSONata:

{“body”:

{"local_time": $fromMillis(body.time*1000, '[Y0001]-[M01]-[D01] [h#1]:[m01]:[s01][P] [z]', body.tz_offset),
"vehicle": body.vehicle_name,
"location_url": "https://www.latlong.net/c/?lat=" & $string(body.latitude) & "&long=" & $string(body.longitude),
"motion": body.motion,
"tracking_enabled": body.tracking_enabled ? "Yes" : "No"
}

}

body.latitude, body.longitude, body.time, body.tz_offset, body.tracking_enabled are pulled from the original note created.

Here is the JSON in the _web.qo file:

{
“event”: “020ad850-82e5-4b18-a80d-xxxxxxxx”,
“when”: 1754249958,
“file”: “_web.qo”,
“body”: {
“body”: {
“local_time”: “2025-08-03 2:39:12pm GMT-05:00”,
“location_url”: “https://www.latlong.net/c/?lat=xx.0062&long=-yy.127”,
“motion”: “Stopped”,
“tracking_enabled”: “No”,
“vehicle”: “[name]”
}
},
“session”: “efa14688-dc49-4861-9eb3-xxxx”,
“best_id”: “dev:xxxx”,
“device”: “dev:xxxx”,
“product”: “product:com.xxx.xxxxx”,
“app”: “app:0de33366-45c4-40b5-b375-xxxx”,
“received”: 1754249969.282741,
“req”: “web.get”,
“best_location_type”: “triangulated”,
“best_location_when”: 1754179207,
“best_lat”: xx.915152,
“best_lon”: -yy.062451,
“best_location”: “city state”,
“best_country”: “US”,
“best_timezone”: “America/Chicago”,
“tower_when”: 1754182905,
“tower_lat”: xx.915892,
“tower_lon”: -yy.06781,
“tower_country”: “US”,
“tower_location”: “city state”,
“tower_timezone”: “America/Chicago”,
“tower_id”: “310,410,14976,461xxxxxxxxx”,
“tri_when”: 1754179207,
“tri_lat”: xx915152,
“tri_lon”: -yy.062451,
“tri_location”: “city state”,
“tri_country”: “US”,
“tri_timezone”: “America/Chicago”,
“tri_points”: 7,
“status”: “success”,
“fleets”: [
“fleet:27ac1d7c-4cd9-4bc6-b890-xxxxxxxx”
]
}

Thanks,

Joe

Hi @scavoj,

There’s a couple of things I’m looking at here:

The best_location_type is “triangulated”, which means it used Wi-Fi triangulation to calculate the location from the Notecard. That location data is, by default, calculated only once per day (but can be overridden). It’s also about 2 hours behind the local_time that you populated in the Note body, so clearly you are getting a more recent location from somewhere else.

Did you issue the {“req”:“card.aux.serial”,“mode”:“gps”} request to tell the Notecard to use the external GPS? Or are you accessing location data from the external GPS separate from the Notecard?

I’d agree that it looks like the Notecard is just using its last known location, but your body contains more recently acquired info.

Rob

Yes, I used {“req”:“card.aux.serial”,“mode”:“gps”}. That correct GPS data is being used in the web.get route body.

I did notice the triangulated loc type and the behavior I’m seeing is congruent with your explanation.

I just now need to figure out why when I take the lat and long from the card.location request and place it in the body, it seem to be losing accuracy. It seems to cut it off after 4 decimal places. Does notehub trim floating point numbers? If not, I’ll just play around with it to find a solution.

Thanks,

Joe

Hi @scavoj,

I’m curious if the “best” values have changed since you last looked? It should be using GPS as the “best” so this may be something I have to escalate here.

In terms of your lat/lon data, Notehub doesn’t trim anything, so it must have to do with how you are casting/formatting those values. Try using a double if you are using float for instance.

Rob

It is still showing

“best_location_type”: “triangulated”,

“best_location_when”: 1754179207,

“best_lat”: xx.915152,

“best_lon”: -yy.062451

with the body values of

“body”: {

“local_time”: “2025-08-05 11:55:53am GMT-05:00”,

“location_url”: “www.latlong.net/c/?lat=xx.9171&long=-yy.0492“,

“motion”: “Stopped”,

“tracking_enabled”: “Yes”, “vehicle”: “vehicle” }

And a when value of:

“when”: 1754412956

which is different than the best_location_when.

Most of the time, the notecard is kept at the best_lat and best_long location, unless I take it out for a ride for testing. This data is while I was at a different location.

And local_time is using the time from {“req”: “card.location”}, which has been accurate.

Thanks,

Joe

It looks like the lat/lon values coming from the gps module thru the notecard is capped at 4 decimal places. Do you know if there is some setting which increases the accuracy of the gps values? All I saw was the speed (baud rate) setting which I have set at the default of 9600.

Thanks,

Joe