mapster icon indicating copy to clipboard operation
mapster copied to clipboard

MultipleTargets not working

Open mhussain opened this issue 7 years ago • 6 comments

Based on the tooltip info for location data

I entered the data as

{"location1": [lat1, lon1], "location2": [lat2, lon2]}

But the console keeps showing the error

TypeError: Cannot read property 'lat' of undefined
    at kibana.bundle.js?v=10229:82769
    at commons.bundle.js?v=10229:45562
    at completeOutstandingRequest (commons.bundle.js?v=10229:33214)
    at commons.bundle.js?v=10229:33491

Which is essentially this line

if (config.multipleTargets) {
  var targetCoords = getCoords([event.target.lat, event.target.lon]);

Any ideas? :(

mhussain avatar Apr 27 '17 03:04 mhussain

I'm a bit busy now I'll give a look this week end

xarkes avatar Apr 27 '17 14:04 xarkes

Sorry, I've been busy those days, I did not have the time to check, neither to install a running version of Kibana on my laptop. I don't remember how I did implement it, but I think the help message is wrong. According to those lines:

      var targetAggId;
      try {
        targetAggId = vis.aggs.bySchemaName['target'][0].id;
      } catch (err) {
        console.log("Target location is not set.");
      }
[...]
        var id = table.columns[i].aggConfig.id;
        switch (id) {

[...[
          case targetAggId:
            targetColumn = i;
            break;
        }
[...]
        if (targetColumn >= 0) {
          data['target'] = geohash.decode(row[targetColumn].key);
        }

This refers to the aggregation named target which means that you need one GeoHash for the event origin coordinates, and another GeoHash for the targeted coordinates. So yes the help message is wrong, I should fix it, but to be clear, if you uncheck the multipleTargets box, then it looks for the GeoHash field you set in the target aggregate. I hope it's more clear, since I did not test it let me know if anything is wrong.

xarkes avatar May 15 '17 17:05 xarkes

@xarkes when you say "So yes the help message is wrong" you are referring to "Multiple targets" help box:

If the attacks should point to different targets, then select this. If you uncheck it, then the targets will point to the same unique location. Values true: use multiple directions false: use only one direction

yes? If so, to be clear, you are saying the option is inverted? i.e. to use multiple locations uncheck the "Multiple targets" box, not check it?

In doing so I have encountered the following errors:

Error: atribute d: Expected number, "….09007377295427LNaN,NaN".

Uncaught TypeError: Cannot read property 'removeChild' of null at destroyPurpleBox (purplebox.js:36) at purplebox.js:51

image

The console also notes that "Target location is not set".

Amorik avatar May 29 '17 22:05 Amorik

Unfortunately I am unable to test it right now and give you a proper solution. I think the correct way is to add the aggregation named "Target location" (target) and to check the box "Multiple targets" and just ignore the one named "Target coordinates" (keep the default value). So this requires each of your event to have an origin geohash and a destination geohash. Try with this and let me know

xarkes avatar May 30 '17 07:05 xarkes

Please Xarkes, i have multiple traget location in a geo_point location, can you explain me how to use it. I'can see multi direction lines in the world map.

Many Thanks

TRISAF avatar Jun 25 '17 17:06 TRISAF

As I said in my previous message, try to use one geohash for the "Coordinates" aggregate and another one for "Target location" aggregate. Then check the box "Multiple targets" in the parameters. This should work fine.

xarkes avatar Jun 26 '17 07:06 xarkes