CitiLogics / citilogics-geoloop-panel

Animated Maps in Grafana
MIT License
44 stars 6 forks source link

How to use Line #7

Open flopp999 opened 6 years ago

flopp999 commented 6 years ago

I can successfully view data with polygon but not with Line. How to do that with a line? Can you help me in the right direction maybe?

samhatchett commented 6 years ago

So you should be able to define your LineString property in your geojson...


{ "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "line_name": "myLine123",
        ...
      },
      "geometry": {
        "type": "LineString",
        "coordinates": [
            [ -105.87799800030689, 33.24399899955506 ],
            [ -105.98500100019538, 33.269000999597324 ],
            ...
        ]
      }
    },
...

And then the other important piece is to enter the two keys that will be joined.

GeoJSON ID Path is the json path (for the above example, it would be properties.line_name)

Series GeoID Tag is the location-identifying tag that you've grouped by (in the query panel)

screen shot 2018-04-12 at 2 15 47 pm

So those three important things: the property must exist in the geojson as a LineString, enter the json path to the identifier, and enter the tag you've grouped by.

flopp999 commented 6 years ago

I am able to get it to work. I have tried to zoom in and zoom out, I cannot see any line anywhere.

this is my line.json

line(
{
"type": "FeatureCollection",
"features": [
    {
    "type": "Feature","properties":
        {
        "line_name": "myLine123"
        },
        "geometry":
            {
            "type": "LineString",
            "coordinates": [ [ -96.1802918, 40.222222 ],[ -96.1802918, 41.222222 ]]
            }
    }
]
}
)

this is my setup in Grafana geoloop geoloop1

samhatchett commented 6 years ago

OK, got some info. It turns out that there may be an issue with displaying fixed colors.

If you set the "Visualization Color Options" to "measurement", the line should magically appear. If this does happen, then that would confirm the issue. Please let me know.

flopp999 commented 6 years ago

I tried with measurement instead of fixed, still no line

samhatchett commented 6 years ago

If you could look at the javascript console output from your browser, that would probably help - any error messages or strange logs?

https://webmasters.stackexchange.com/questions/8525/how-do-i-open-the-javascript-console-in-different-browsers

flopp999 commented 6 years ago

It says: mapbox-gl.js:417 Error: The layer 'f-1523636320000' does not exist in the map's style and cannot be styled. at t.setPaintProperty (mapbox-gl.js:305) at e.setPaintProperty (mapbox-gl.js:391) at GeoLoop.stepFrame (geoloop.js:230) at eval (geoloop.js:199)

f-xxxxxxxxxxxxxxxxxx is counting upwards, it is epoch time i guess

flopp999 commented 6 years ago

at the top is says mapbox-gl.js:417 Error: layers.f-1523636520000.paint.line-opacity: 76 is greater than the maximum value 1 at Function.module.exports.emitErrors (mapbox-gl.js:325) at t._validate (mapbox-gl.js:305) at t.addLayer (mapbox-gl.js:305) at e.addLayer (mapbox-gl.js:391) at eval (geoloop.js:175) at Array.forEach () at GeoLoop.createFramesSafely (geoloop.js:131) at eval (geoloop.js:77)

flopp999 commented 6 years ago

My mistake, I think I have played with this opacity number, let me change that

samhatchett commented 6 years ago

also worth noting - I made some more commits after the 1.1 tag, which might fix this issue. I cannot reproduce the issue using the current repository version.

I will tag the 1.1.1 release and put that through to the grafana-plugin list.

flopp999 commented 6 years ago

I am using 1.1.1, installed it a few seconds ago, using this command grafana-cli plugins install citilogics-geoloop-panel

samhatchett commented 6 years ago

right, just saw that the plugin directory has 1.1.1 - however, there was a minor patch after that related to maps failing to render. You could wait for the directory to be updated, or clone the plugin directly from this repo instead of using the grafana-cli. As for a workaround, try the grafana refresh button?

flopp999 commented 6 years ago

I used git in my Debian, so now have the latest version, still not possible to make line. It says Error: The layer 'f-1523638190000' does not exist in the map's style and cannot be styled.

flopp999 commented 6 years ago

at the top in java console Uncaught TypeError: Cannot read property 'forEach' of undefined at GeoLoopCtrl.updateGeoDataFeatures (geoloop_ctrl.js:293) at Object.success (geoloop_ctrl.js:222) at u (jquery.js:3317) at Object.fireWith [as resolveWith] (jquery.js:3447) at r (jquery.js:9272) at HTMLScriptElement.n (jquery.js:9639) at HTMLScriptElement.dispatch (jquery.js:5206) at HTMLScriptElement.g.handle (jquery.js:5014)

flopp999 commented 6 years ago

Thank you for all your help, you are quick to reply 👍 No rush for this, I am only checking what we can use to present data in different ways. Will try with Point instead