The Worldmap Panel plugin for Grafana's documentation specifies the necessary input data like the following:
[
{
"key": "SE",
"latitude": 60.128161,
"longitude": 18.643501,
"name": "Sweden"
},
{
"key": "US",
"latitude": 37.09024,
"longitude": -95.712891,
"name": "United States"
}
]
Source: https://grafana.com/grafana/plugins/grafana-worldmap-panel/
I've tried inputting data by using a Zabbix data source and a JSON/JSONP endpoint under the panel's "Map Data Options".
JSON Endpoint Response Data:
[
{
"name": "United States",
"key": "US",
"longitude": -85.997,
"latitude": 37.7529
},
{
"name": "Australia",
"key": "AU",
"longitude": 151.2006,
"latitude": -33.8715
},
{
"name": "United States",
"key": "US",
"longitude": -122.0438,
"latitude": 37.3177
},
{
"name": "United Kingdom",
"key": "GB",
"longitude": -1.6451,
"latitude": 54.9749
},
{
"name": "Portugal",
"key": "PT",
"longitude": -8.6793,
"latitude": 41.1691
},
{
"name": "United States",
"key": "US",
"longitude": -96.6146,
"latitude": 33.6416
},
{
"name": "Egypt",
"key": "EG",
"longitude": 29.7432,
"latitude": 30.9977
},
{
"name": "United Kingdom",
"key": "GB",
"longitude": -0.2972,
"latitude": 51.5571
},
{
"name": "United States",
"key": "US",
"longitude": -97.0951,
"latitude": 32.8285
}
]
Zabbix Data Source:
[{"name":"Trinidad and Tobago","key":"TT","longitude":-61.4692,"latitude":10.2843},{"name":"Australia","key":"AU","longitude":151.2006,"latitude":-33.8715},{"name":"United Kingdom","key":"GB","longitude":-1.6451,"latitude":54.9749},{"name":"United States","key":"US","longitude":-96.6146,"latitude":33.6416},{"name":"United Kingdom","key":"GB","longitude":-0.2972,"latitude":51.5571},{"name":"Egypt","key":"EG","longitude":29.7432,"latitude":30.9977},{"name":"United States","key":"US","longitude":-97.0951,"latitude":32.8285}]
Both options show nothing on the map. I've tried various options and nothing seems to work.
Am I misunderstanding how the map should consume this data?
If so, how would I proceed with transforming the data from their respective source?
My Worldmap Panel Setup
Related
I'm trying to add a weather WebPart on a modern page in SharePoint Online.
This is the PowerShell I'm executing:
$jsonProperties = '
{
"serverProcessedContent": {
"searchablePlainTexts": {
"webPartTitle": "Weather"
}
},
"properties": {
"temperatureUnit": "C",
"locations": [
{
"countryName": "Australia",
"name": "Manjimup, Australia",
"latitude": -34.24055862426758,
"longitude": 116.14610290527344,
"showCustomizedDisplayName": false
},
{
"countryName": "Australia",
"name": "Bega, Australia",
"latitude": -36.673919677734378,
"longitude": 149.84178161621095,
"showCustomizedDisplayName": false
}
]
}
}'
Add-PnPClientSideWebPart -Page https://mysharepointsite.sharepoint.com/Sites/MyPage -DefaultWebPartType Weather -WebPartProperties $jsonProperties
The WebPart is being added but there are no weather locations, as shown below.
What am I missing for the locations to be added to the WebPart?
I was missing the property "dataVersion": "1.2". The full JSON looks like this:
$jsonProperties = '
{
"dataVersion": "1.2",
"serverProcessedContent": {
"searchablePlainTexts": {
"webPartTitle": "Weather"
}
},
"properties": {
"temperatureUnit": "C",
"locations": [
{
"countryName": "Australia",
"name": "Manjimup, Australia",
"latitude": -34.24055862426758,
"longitude": 116.14610290527344,
"showCustomizedDisplayName": false
},
{
"countryName": "Australia",
"name": "Bega, Australia",
"latitude": -36.673919677734378,
"longitude": 149.84178161621095,
"showCustomizedDisplayName": false
}
]
}
}'
{
"_id": ObjectID("5e576bf5d72a185fcf11e03f"),
"location": {
"latitude": 27.6648,
"longitude": 81.5158,
"city": "Florida",
"state": "Florida",
"country": "United State"
},
"description": "This is for test",
"distance" : "100" //Miles
}
How can get the record that calculate the minium distance between coordinates tried difference way didn't get success
I am currently working with a mongodb containing a collection of companies with the following structure:
{
"_id": "52cdef7c4bab8bd675297d8e",
"name": "Facebook",
"offices": [{
"description": "Headquarters",
"address1": "1601 Willow Road",
"address2": "",
"zip_code": "94025",
"city": "Menlo Park",
"state_code": "CA",
"country_code": "USA",
"latitude": 37.41605,
"longitude": -122.151801,
"location": {
"type": "Point",
"coordinates": [-122.151801, 37.41605]
}
}, {
"description": "Europe HQ",
"address1": "",
"address2": "",
"zip_code": "",
"city": "Dublin",
"state_code": null,
"country_code": "IRL",
"latitude": 53.344104,
"longitude": -6.267494,
"location": {
"type": "Point",
"coordinates": [-6.267494, 53.344104]
}
}, {
"description": "New York",
"address1": "340 Madison Ave",
"address2": "",
"zip_code": "10017",
"city": "New York",
"state_code": "NY",
"country_code": "USA",
"latitude": 40.7557162,
"longitude": -73.9792469,
"location": {
"type": "Point",
"coordinates": [-73.9792469, 40.7557162]
}
}]
}
As the example shows a company can have multiple offices.
What I would like to know is, if it is possible to create a geospatial index at offices level not at document (root) level? For example, the user of my application is currently in Dublin and searches within a distance of 50km, he/she will get "Facebook, Europe HQ" in his/her results and not just "Facebook"?
If yes, how can I achieve that, if not what could I do then?
I'm working with the Facebook Graph API and I was wondering which fields are available for the &fields parameter and also where do I find any documentation about those fields.
I could only find the Search types for the &type parameter in the documentation for example the page Search type let's you search for a page if you provide a name to be queried.
Example request
search?q=Facebook&type=page
Example response
{
"data": [
{
"category": "Computers/technology",
"name": "Facebook Engineering",
"id": "9445547199"
},
{
"category": "Product/service",
"name": "Facebook",
"id": "103274306376166"
},
{
"category": "Product/service",
"name": "Facebook Developers",
"id": "19292868552"
},
{
"category": "Media/news/publishing",
"name": "Facebook Stories",
"id": "114770288670819"
}
]
}
If I now need some specified fields from this collection I know from a previous experience that I could use the &fields parameter to extract them or filter them out.
Example request
search?q=Facebook&type=page&fields=name, likes, location
Example response
{
"data": [
{
"name": "Facebook NY",
"likes": 71564,
"location": {
"street": "770 Broadway",
"city": "New York",
"state": "NY",
"country": "United States",
"zip": "10003",
"latitude": 40.730901749524,
"longitude": -73.991377364328
},
"id": "28864583650"
},
{
"name": "Facebook London",
"likes": 56441,
"location": {
"street": "10 Brock Street",
"city": "London",
"state": "",
"country": "United Kingdom",
"zip": "NW1 3FG",
"latitude": 51.5258476,
"longitude": -0.1394228
},
"id": "265781023507354"
},
{
"name": "Facebook Paris",
"likes": 29740,
"location": {
"street": "",
"city": "Paris",
"state": "",
"country": "France",
"zip": "75017",
"latitude": 48.883443087419,
"longitude": 2.3023060392957
},
"id": "147424071942327"
}
]
}
I used the Graph API Explorer to do this
TLDR; is there a list or documentation available for all the options/specific fields in the &fields parameter?
Although there is no complete documentation, for any element you can query
{id}?metadata=1
this will give you a full list of fields and edges that are available for that object type (as well as its type at the very bottom)
sample call: https://graph.facebook.com/v2.8/me?metadata=1
There is no exact documentation on the search fields endpoint.
An educated guess would be that based on the type you can inspect the fields of that page.
Example, for type=page the fields available will be listed at https://developers.facebook.com/docs/graph-api/reference/v2.2/page
Hey I have a response string in this format
ok my original resonse string is like this
{
"data": [
{
"name": "Santa Fe Plaza",
"category": "Landmark",
"location": {
"city": "Santa Fe",
"state": "NM",
"country": "United States",
"latitude": 35.687071155202,
"longitude": -105.93767717603
},
"id": "108196762542063"
},
{
"name": "Museum of Contemporary Native Arts",
"category": "Museum/art gallery",
"location": {
"street": "108 Cathedral Place",
"city": "Santa Fe",
"state": "NM",
"country": "United States",
"zip": "87501",
"latitude": 35.686915835451,
"longitude": -105.93725120129
},
"id": "106209180361"
}
]
}
I have to extract all the names from there Please enlighten me how to achieve this
JSON parser is throwing error all the time
Thanx in advance
Start by downloading the JSON framework
And a Good Tutorial to Start learning: JSON Framework for iPhone
Also see: How to parse JSON files on iPhone in Objective-C into NSArray and NSDictionary