Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map source JSON format #97

Open
Hipska opened this issue Dec 4, 2019 · 4 comments
Open

Map source JSON format #97

Hipska opened this issue Dec 4, 2019 · 4 comments

Comments

@Hipska
Copy link
Contributor

Hipska commented Dec 4, 2019

Hi, I can't seem to find anywhere what the correct format for the map source JSON should be, what each item means, which items are required, ...

@daldoyle
Copy link
Contributor

daldoyle commented Dec 4, 2019

There are some examples in the README to help get started. The map JSON is fairly complex and we are actually working on creating a 2.0 rev of this that has some dynamic editing via point and click vs building out the JSON objects manually or (how we do it) with scripts.

Generally speaking each item in the results.links array is a line on the map. The links.endpoints defines how to map data coming back from your datasource onto the map. The target in Grafana needs to match the links.endpoints.name exactly in order to be associated correctly. The label for the endpoint is a more human friendly name that can be utilized in say the hover tooltip.

The path is the series of points to draw the line along. You need at least two to make a straight line - additional points in between cause the line to bend towards those points and is how to accomplish curvature.

The results.endpoints array is a set of end point locations to draw. Normally this is a reduced set of the endpoints on the paths, but also provides info for things like names. Most of the fields in the example aren't really used most of the time - just name, lat, and lon.

Hopefully that helps. As I said above, we're working on making the UX of designing and updating maps a lot more cleaner in a future rev of this. Ideally people would not need to look at the raw JSON going forward at all.

@Hipska
Copy link
Contributor Author

Hipska commented Dec 4, 2019

That's nice to hear. Could this text be added to the README please? I also found that there can be a results.endpoints.label field.

@TimWeberCoM
Copy link

TimWeberCoM commented Feb 3, 2020

daldoyle,

I love the look of your product. I'm trying to pull data from an Influx DB and I'm not very good with coding. I've got the map set up and I'm getting the endpoints and link set up, but there's no data.

Do you have any examples of the JSON file we'd need to use?

Here's what I have so far:
Capture

JSON:
{
"results": [
{
"links": [
{
"endpoints": [
{
"name": "MDC-MCH-In",
"label": "MDC to MCH Input"
},
{
"name": "MDC-MCH-Out",
"label": "MDC to MCH Output"
}
],
"name": "MDC-MCH",
"path": [
{
"lat": "xx.xxxxxx",
"lon": "-xx.xxxxxx",
"name": "MDC"
},
{
"lat": "xx.xxxxxx",
"lon": "-xx.xxxxxx",
"name": "MCH"
}
]
}
]
}
]
}

@TimWeberCoM
Copy link

TimWeberCoM commented Feb 3, 2020

Hey, I got it. Here's what I did if anyone else needs to use it.

Capture2

And here's the JSON:

{
"results": [
{
"links": [
{
"endpoints": [{"name": "MDC-MCH-In","label": "MDC to MCH Input"},{"name": "MDC-MCH-Out","label": "MDC to MCH Output"}],
"name": "MDC to MCH",
"path": [{"lat": "xx.xxxxxx","lon": "-xx.xxxxxx","name": "MDC"},{"lat": "xx.xxxxxx","lon": "-xx.xxxxxx","name": "MCH"}]
}
]
}
]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants