'feedback' missing several fields
In v5.0.3 When using 'feedback' as described in https://flows.nodered.org/node/node-red-contrib-web-worldmap "Events From the Map".
The documentation states that I should expect to get something like:
{"payload": {
"action": "feedback",
"name": "some name",
"value": "some value",
"lat":51, "lon":0,
"layer":"unknown"
}
}
The value I am returning is a json object.
{"payload": {
"name":"my_spot_report",
"action":"feedback",
"value":{
"attitude":"friend",
"geoObject":"Gnd Equip Vehicle",
"timeout":"600",
"name":"jan",
"bearing":0,
"distance":1,
"how":"nonCoT"}
},
},
"topic":"tak-map",
"_sessionid":"4d8ff0dd-c1d7-41f2-8c13-c70c07f63017",
"_sessionip":"10.2.118.201",
"_msgid":"2155e06325ebcb78"
}
The 'lat', 'lon', and 'layer' are all missing.
Is this is the same problem reported in https://github.com/dceejay/RedMap/issues/278 creeping back in?
https://github.com/dceejay/RedMap/blob/7d1782cc8b89537740921eb2c81123356c0d3a6d/worldmap/worldmap.js#L924-L941
It appears that in order to get the lat,lon the 'name' (the first argument of the 'feedback' function) must be 'map'.
If this is not a bug it should be explained in the documentation for the 'feedback' function. https://github.com/dceejay/RedMap/blob/7d1782cc8b89537740921eb2c81123356c0d3a6d/README.md#L688 https://github.com/dceejay/RedMap/blob/7d1782cc8b89537740921eb2c81123356c0d3a6d/README.md#L706
Feedback Options and Documentation Clarification
The feedback mechanism offers multiple options. The documentation states (under the "Event from the Map" section):
json
Copy code
{
"action": "feedback",
"name": "some name",
"value": "some value",
"lat": 51,
"lon": 0,
"layer": "unknown"
}
// when a user calls the feedback function - see below
This is the default behavior (feedback()), kept only for backward compatibility.
If you are using the feedback as a utility function and wish to report the right mouse click latitude and longitude position, you can use the rclk.lat and rclk.lng variables from your custom feedback code. This allows you to create your own custom feedback content. You could also send other positional data or any other data in the utility use case.
The payload in your issue suggests that you are not using the simple "event from map" option, but rather using feedback as a utility function. In this case, you could build your payload like this:
json
Copy code
{
"payload": {
"name": "my_spot_report",
"action": "feedback",
"value": {
"attitude": "friend",
"geoObject": "Gnd Equip Vehicle",
"timeout": "600",
"name": "jan",
"lat": yourSpotLat,
"lon": yourSpotLon,
"bearing": 0,
"distance": 1,
"how": "nonCoT"
}
},
"topic": "tak-map",
"_sessionid": "4d8ff0dd-c1d7-41f2-8c13-c70c07f63017",
"_sessionip": "10.2.118.201",
"_msgid": "2155e06325ebcb78"
}
You could inject the spot device reported position the same way you inject the bearing and distance into the utility function.
Refer to the "Moving Icon Demo & Builder" example, where I've added a map context menu using the mouse right-click latitude and longitude to create a new object. The object context menu uses object's position data as default, double-clicking to pull mouse position, but you could also input other position data manually.