How to use geographic coordinate with Echarts graph? - graph

I'm trying to use a geographic coordinate with Echarts graph. For example, the graph example given on the website are as follows: [here is the example link about the graph][1]
[![example graph][2]][2]
the data format is as follows:
{
"nodes":[
{
"id":"0",
"name":"Myriel",
"symbolSize":19.12381,
"x":-266.82776,
"y":299.6904,
"value":28.685715,
"category":0
},
{
"id":"1",
"name":"Napoleon",
"symbolSize":2.6666666666666665,
"x":-418.08344,
"y":446.8853,
"value":4,
"category":0
}],
"links":[
{
"source":"1",
"target":"0"
},
{
"source":"2",
"target":"0"
}]}
The document says I can use geographic coordinate with geoIndex to assign the corresponding geographic coordinate components.So I constructed my own graph data which is as follows:
tmp = {
"nodes":[
{
"id":0,
"name":"A",
"x":106.715912,
"y":29.510934,
"value":2.7493110918413546,
"category":0
},
{
"id":1,
"name":"B",
"x":106.375811,
"y":29.242566,
"value":2.4366801109834597,
"category":1
},
{
"id":2,
"name":"C",
"x":106.628127,
"y":29.318595,
"value":1.0339437768234796,
"category":1
},
{
"id":3,
"name":"D",
"x":106.297996,
"y":29.512318,
"value":0.7788528349157652,
"category":0
}
],
"links":[
{
"source":"0",
"target":"1"
},
{
"source":"0",
"target":"2"
},
{
"source":"1",
"target":"2"
},
{
"source":"1",
"target":"3"
}
],
"categories":[
{
"name":"SectionA"
},
{
"name":"SectionB"
}
]
};
Then, I add the corresponding attribute coordinateSystem:'geo',while it does not work. When I comment out this line,it shows like as follows. However, the positional relationship between these points is not as shown in the figure.
[![my graph][3]][3]
So,
[1]: https://echarts.apache.org/examples/zh/editor.html?c=graph
[2]: https://i.stack.imgur.com/gVQeP.png
[3]: https://i.stack.imgur.com/iDNty.png

Related

Kibana Vega-Lite use aggregates as data

I am new with Vega-Lite in Kibana. I am trying to produce a bar chart in Kibana using Vega.
I use Vega because I have to use nested fields, and it seems there are not other options.
I don't want to plot a time series, I want to directly plot aggregates.
This is my script:
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"title": "Event counts from all indexes",
data: {
name: "aggregations"
url: {
%context%: true
%timefield%: timestamp
index: search-sonarqube-telemetry-2021-merged
body: {
"aggs": {
"languages": {
"terms": { "field": "plugins.name.keyword"}
}
}
size: 0
}
}
format: {property: "aggregations.languages.buckets" }
}
mark: bar
encoding: {
y: {
field: "buckets.key"
type: nominal
axis: { title: null }
}
x: {
field: "buckets.doc_count"
type: quantitative
axis: { title: "Document count" }
}
}
transform: [
{"filter":
{"field": "doc_count", "range": [0,100000]}
}
]
}
Everything is empty.
If I try to debug, I see the source_0, with the correct data I would like to plot, but not the data_0.
I also get the warnings:
Infinite extent for field "buckets.doc_count_start": [Infinity, -Infinity]
Infinite extent for field "buckets.doc_count_end": [Infinity, -Infinity]
What is wrong in my script?
Thanks
I found the problem.
I defined the property as aggregations.languages.buckets, but the I was defined the fields as buckets.key and buckets.doc_count in the encoding.
It was enough to replace key and doc_count to buckets.key and buckets.doc_count and it worked.
Actually it was not finding the fields because inside aggregations.languages.buckets we don't have a repetition of buckets.

Here geocode api gives double results

Some API geocode queries return double results when this is not warranted by the real data.
It will return 2 results with slightly different latitude and longitude and different LocationId's.
This makes it difficult if not impossible to decern which one is the correct result.
Example:
https://geocoder.ls.hereapi.com/6.2/geocode.json?apiKey=8888&city=Zutphen&country=NL
Returns:
{
"Response":{..
},
"View":[
{
"Result":[
{
"Relevance":1.0,
"MatchLevel":"city",
"MatchQuality":{
"City":1.0
},
"Location":{
**"LocationId":"here:cm:namedplace:23055957",**
"LocationType":"point",
**"DisplayPosition":{
"Latitude":52.1402,
"Longitude":6.19152**
},
...
},
"Address":{
"Label":"Zutphen, Gelderland, Nederland",
"Country":"NLD",
"State":"Gelderland",
"County":"Zutphen",
"City":"Zutphen",
"PostalCode":"7201",
"AdditionalData":[
{
"value":"Nederland",
"key":"CountryName"
},
{
"value":"Gelderland",
"key":"StateName"
},
{
"value":"Zutphen",
"key":"CountyName"
}
]
}
}
},
{
"Relevance":1.0,
"MatchLevel":"city",
"MatchQuality":{
"City":1.0
},
"Location":{
**"LocationId":"here:cm:namedplace:20201443",**
"LocationType":"point",
**"DisplayPosition":{
"Latitude":52.13764,
"Longitude":6.20777**
},
...
],
"ViewId":0
}
]
}
}

Repeat values in PAW, POST request

I wanted to ask if it is possible to repeat elements in a POST request in PAW and how to do so?
Basically, given the POST request BODY:
[
{ "zip":"DYNAMIC_VALUE" }
]
Can I then repeat this entry multiple times? Let's say I want to repeat this entry in the array 10 times, I would get for example:
[
{ "zip":"1234" },
{ "zip":"2543" },
{ "zip":"6543" },
{ "zip":"7645" },
{ "zip":"2654" },
{ "zip":"7568" },
{ "zip":"5364" },
{ "zip":"1313" },
{ "zip":"5432" },
{ "zip":"5634" }
]
And maybe I want to send an array with 1000 or more objects with a dynamic zip.
How do I do that?
Thank you :)

reading in and merging multiple .las in a pdal pipeline file

I can read in and output single .las files in a pipeline file.
How do I read in two .las files, merge them, then apply the filter and output based on the below example?
{
"pipeline":[
{
"type":"readers.las",
"filename":"E:\\offload\\3dspatial\\processed\\99.526\\201406071257\\201406071257.las",
"spatialreference":"EPSG:32635"
},
{
"type":"filters.chipper",
"capacity":600
},
{
"type":"writers.pgpointcloud",
"connection":"host='localhost' dbname='db' user='user' password='pw'",
"schema":"pointcloud_99_526",
"table":"pc_201406071257",
"compression":"dimensional",
"srid":"32635"
}
]
}
This seems to work just testing it.
{
"pipeline":[
{
"type":"readers.las",
"filename":"E:\\offload\\3dspatial\\processed\\99.526\\201607150650\\201607150650.las",
"spatialreference":"EPSG:32635",
"tag":"A"
},
{
"type":"readers.las",
"filename":"E:\\offload\\3dspatial\\processed\\99.526\\201607140910\\201607140910.las",
"spatialreference":"EPSG:32635",
"tag":"B"
},
{
"type":"filters.merge",
"tag":"merged",
"inputs":[
"A",
"B"
]
},
{
"type":"filters.chipper",
"capacity":600
},
{
"type":"writers.pgpointcloud",
"connection":<info>,
"schema":"pointcloud_99_526",
"table":"pc_merge_201607150650_201607140910",
"compression":"dimensional",
"srid":"32635"
}
]
}

Google Analytics: Filter by custom dimension

I'm using the enhanced ecommerce tracking from Google Analytics to send data like this in JS to GA:
ga("ec:addImpression", {
brand: null,
dimension2: "shop123",
id: 1,
list: "Search",
name: "Product 123",
position: 1
});
ga("send", "pageview");
Then, I use the Reporting API to generate some charts. Here, I want to filter by my custom dimension dimension2. The request looks like this:
{
"reportRequests":[
{
"dateRanges":[
{
"startDate":"2016-10-17",
"endDate":"2016-11-16"
}
],
"viewId":"132093148",
"metrics":[
{
"expression":"ga:productListViews"
}
],
"dimensions":[
{
"name":"ga:date"
},
{
"name":"ga:dimension2"
}
],
"dimensionFilterClauses":[
{
"filters":[
{
"dimension_name":"ga:dimension2",
"operator":"EXACT",
"expressions":[
"shop123"
]
}
]
}
]
}
]
}
However, this returns no results:
{
"reports":[
{
"columnHeader":{
"dimensions":[
"ga:date",
"ga:dimension2"
],
"metricHeader":{
"metricHeaderEntries":[
{
"name":"ga:productListViews",
"type":"INTEGER"
}
]
}
},
"data":{
"totals":[
{
"values":[
"0"
]
}
]
}
}
]
}
But when I remove the dimensionFilterClauses I get all the results, of course not filtered by dimension2.
Did I anything wrong when filtering for that dimension?
Change your string dimension_name for dimensionName and try.
As you can see in the examples: https://developers.google.com/analytics/devguides/reporting/core/v4/samples
"dimensionFilter":
{
"dimensionName":"ga:browser",
"operator":"EXACT",
"expressions":["Safari"]
}

Resources