dceejay / RedMap

A web map app for Node-RED to put blobs on
Apache License 2.0
110 stars 60 forks source link

Map Rotation heading issue #250

Closed Shalvan closed 1 year ago

Shalvan commented 1 year ago

Hello @dceejay,

Than You for amazing work with implementing map rotation, however I've noticed that there is small issue whith heading of icon. For example map rotation = 0, arrow heading 180 everything is as expected. but if i rotate the map to 90 than speed vector is pointing in proper direction but arrow icon still points 180 witch in fact is 180 + 90 = 270 real degree. Im attaching a small photo there you can see. 115039

dceejay commented 1 year ago

can you try editing line 1755 of node-red-contrib-web-worldmap/worldmap//worldmap.js to be

  var dir = parseFloat(data.hdg ?? data.heading ?? data.bearing ?? "0") + map.getBearing();

IE add the map.getBearing() to the end... Or maybe we need - rather than + :-)

that isn't the complete fix, but should get you going.

Shalvan commented 1 year ago

Than You so much for this help :)

I've tried var dir = parseFloat(data.hdg ?? data.heading ?? data.bearing ?? "0") + map.getBearing(); And it seams to work now as expected i will investigate it more when i'll reconnect GPS back (now i am testing without).

dceejay commented 1 year ago

great, as I said it's not a complete fix as it won't update "old" markers... but should be fine for live... Proper fix will be in v4 later this week.

Shalvan commented 1 year ago

Yes thats correct, it is not updating the markers but i made a litle work arround... My inject node is at the moment parsing: payload.heading as well as payload.command.rotate - both of them are the same. and to force the map to have this point in the center i am parsing in the same inject node payload.lon and payload.command.lon - both of them are the same. payload.lat and payload.command.lat - both of them are the same.

dceejay commented 1 year ago

v4 now released