heat map development - color regulation - heatmap

I am trying to visualize geo data in a city. I would like to show the density in different colors. Is it possible? I am referring to the picture below. Also I would like to add one heat map in this heat map. The on that fits in can have as the one below only one color. How do I do this?
city heat map
Here is an out-cut of my code: "a69=48.1271,11.5397&rad69=1k&l69=3&a70=48.1513,11.5545&rad70=1k&l70=3&a71=48.1811,11.6057&rad71=1k&l71=3
"
I am happy if someone can help. Regards,
Elisabeth

You specify different colors with the level of heat parameters l0, l1, l2, etc. corresponding with the region and radius. You can find more in the API documentation:
Level of heat for the area/region. Levels have to be
distinguished by indexes when showing multiple areas/regions i.e.l0,
l1 etc. The index number is used for linking the level to similarly
indexed area/region. When presenting only a single area/region, the
index 0 of the parameter is not required i.e. plain l can be used.
Currently there are 4 different level values supported: 0, 1, 2 and 3.
If not defined for certain index, similarly indexed area/region will
use level 0 by default. Levels are represented on map by using
following pre-defined colors:
0 - Blue
1 - Purple
2 - Red
3 - Yellow
Using the heatmap example from the docs and your parameters you are setting each to yellow. You can also change the opacity and color palette with additional parameters.
For example:
curl -X GET -H 'Content-Type: *' --get 'https://image.maps.api.here.com/mia/1.6/heat' --data-urlencode 'app_id=APP_ID_HERE' --data-urlencode 'app_code=APP_CODE_HERE' --data-urlencode 'a0=48.1271,11.5397' --data-urlencode 'rad0=1k' --data-urlencode 'l0=3' --data-urlencode 'a1=48.1513,11.5545' --data-urlencode 'rad1=1k' --data-urlencode 'l1=2' --data-urlencode 'a2=48.1811,11.6057' --data-urlencode 'rad2=1k' --data-urlencode 'l2=1'
Gives the following result:

Related

Zabbix api value is different from Graph value

i have zabbix 5. I've been trying to write a shell script to get item trend for a range of time. the shell script works correctly but the value it return doesn't match what is showing on graph.
for example:
I have an item with itemid "10234" which return "percentage of used CPU".
i want to get the zabbix trend for this item from "2021/09/20 09:00:00" till "2021/09/21 09:00:00".
Unix time for this rang is: 1632112200 , 1632198600
I run this command to get the values:
curl -L -k -i -X POST -H 'Content-Type:application/json' -d '{"jsonrpc":"2.0","method":"trend.get","id":1,"aut h":"1a543455bd48e6ddc222219acccb52e9","params" : {"output": ["clock","value_avg","value_min","value_max","num", "itemid"],"itemids":["10234"],"time_from": "1632112200","time_till": "1632198600", "limit": "1"}}' https://172.30.134.03:423//api_jsonrpc.php
output:
{"clock":"1632114000","value_avg":"14.968717529411 764","value_min":"12.683622999999997","value_max": "17.635707999999994"}
but in Graph it shows:
why this happens and how to fix it?
In most cases, the graphs apply approximations. If you zoom in, you should see the same data you get from the API. The most zoom you can apply is 1 minute, while the API will get you the exact point in time value.

Google drive API files list size <= 100 when specify fields parameter

When i specify fields parameter in files list request, i only get 100 records of files in response. But in API documentation written about pageSize parameter: "The maximum number of files to return per page. Partial or empty result pages are possible even before the end of the files list has been reached. Acceptable values are 1 to 1000, inclusive. (Default: 100)".
curl \
'https://www.googleapis.com/drive/v3/files?pageSize=500&fields=nextPageToken%2Cfiles(id%2C%20name%2C%20parents%2C%20mimeType%2C%20owners%2C%20permissions)' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed
only 100 records max in response
As a workaround I'd avoid using "fields" parameter if a wanted to retrieve 1000 items
There's already a public report regarding this: https://issuetracker.google.com/issues/154155376
This is normal due to the limit of characters. The limit is dependent on both the server and the client used so when it comes to add more characters, Drive API will try to reduce the characters length sent in the payload.
In a summary, you should reduce the size of files to retrieve if those fields are mandatory.
The documentation says pageSize -> The maximum number of files to return per page. Partial or empty result pages are possible even before the end of the files list has been reached. Acceptable values are 1 to 1000, inclusive. (Default: 100)
If you find this to be a blocker for your application, Google recommends to use Google Issue Tracker in order to report a bug or ask for a new feature.
As a different approach specify the pageToken in your requests
By following your request template, here are the changes:
curl \
'https://www.googleapis.com/drive/v3/files?pageSize=100&pageToken=[TOKEN]&fields=nextPageToken, files(id, name, parents, mimeType, owners, permissions)' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed
As I mentioned before due to the HTTP limitations on server side use the page nextPageToken that you get in the response and request 100 items so you can avoid these limitations.
Keep in mind that this approach will need more requests than before.

The forge script 'test-list-resources' only list 10 items

The forge script 'test-list-resources' only list 10 items. How do we list all the resources? Besides the command-line script, is it possible to view all resource somewhere online?
And I found that it 's not listing the latest 10 items, it lists the first 10 items after sorting by the URN(which is very long and human-unreadable), this is not so intuitive in usability, because usually user upload the model and could forget the URN and they might want to check the URN by executing this script.
Can you please clarify where the test-list-resource script came from?
Also from my perspective this script under the hood use one of the next methods:
1.Get Buckets
2.Get Bucket by Key
Both of them them you can use for getting bucket(s) with content. And for both of them you can specify limit as Query String Parameter, and now you have 10 because this value GET methods use by default. To getting more them 10 you just need to set higher value up to 100(max value)
Updated
After checking script source I found that we use second of GET methods - Get Bucket by Key. And the quickest solution that I can propose to you - is just jump in script code and edit 1 line. Basically you need only add limit param to query (for GET buckets/:bucketKey/objects curl request). And you can do this in few ways:
Hardcode 'limit' equal 100
response=$(curl -H "Authorization: ${bearer}" -X GET ${ForgeHost}/oss/v2/buckets/${bucket}/objects?limit=100 -k -s)
Pass value to script from shell environment variables
first
export BUCKET_LIMIT=<<YOUR LIMIT VALUE>>
then
response=$(curl -H "Authorization: ${bearer}" -X GET ${ForgeHost}/oss/v2/buckets/${bucket}/objects?limit=$BUCKET_LIMIT -k -s)
If you run script with 'sh' command you can add inline parameter
first
response=$(curl -H "Authorization: ${bearer}" -X GET ${ForgeHost}/oss/v2/buckets/${bucket}/objects?limit=$1 -k -s)
then
sh test-list-resources 100
Also thank you for notice this case, I will connect with script's author and create proposal for adding new functionality regarding limits and other params

Filter by attribute value in Orion Context Broker SQL Style - "Attribute" LIKE '%text%'

Following NGSIv2 specification document is there any way to search entities by part of attribute string value?
Something like
http://192.168.36.95:1026/v2/entities?type=POI&options=keyValues&q=Description=='PART OF TEXT'
to get entities that Description attribute contains 'PART OF TEXT'
you can use the match pattern operator. see below
~=. The value matches a given pattern, expressed as a regular expression, e.g. color~=ow. For an entity to match, it must contain the target property (color) and the target property value must match the string in the right-hand side, 'ow' in this example (brown and yellow would match, black and white would not). This operation is only valid for target properties of type string.
so in your case it would be
http://192.168.36.95:1026/v2/entities?type=POI&options=keyValues&q=Description~=
It is possible to apply REGEXP matching to ID NGSI field:
You can filter using entity id patterns, using the idPattern URL
parameter (whose value is a regular expression). For example, to get
all entities whose id starts with Room and is followed by a number in
the 2 to 5 range (in this case retrieving Room2) you can use (note the
-g in curl command line to avoid problems with brackets): curl localhost:1026/v2/entities?idPattern=^Room[2-5] -g -s -S -H 'Accept:
application/json' | python -mjson.tool
found at:
https://fiware-orion.readthedocs.io/en/master/user/walkthrough_apiv2/index.html#getting-all-entities-and-filtering
I'm not sure if this apply also to NGSI Type. But this functionality doesn't apply to user defined attributes.

{"errorMessages":["Unexpected character (''' (code 39)): expected a valid value

I found "Query using POST" from here.
And tried to use curl command from command like. Installed curl by refering this for windows.
Here is my CURL string:
curl -D- -u admin:password -X POST -H "Content-Type: application/json" --data
'{"jql":"project = CI","startAt":0,"maxResults":50,"fields":["summary","status","assignee"]}'
"https://myclientname.atlassian.net/rest/api/2/search"
This is how I'm doing and getting error:
{"errorMessages":["Unexpected character (''' (code 39)): expected a valid value
(number, String, array, object, 'true', 'false' or 'null')\n
at [Source: org.apache.catalina.connector.CoyoteInputStream#1626cb2; line: 1, column: 2]"]}
Is there any problem making this curl string in windows? Please suggest? How can I correct this and get JSON object? Please note that, userID, password and client name is correct. Thanks.
Seems to be an windows issue. Do not use the ' (single-quote) character.
Instead, use " (double-quote) character for enclosing the string. Then, if you have inner quotes, use """ (3x double-quotes) to escape them.
Example: "{ """name""":"""Frodo""", """age""":123 }"
I tried the cURL you pointed to in your question, but with no luck. Also, the cURL comes with Git is not working either. However, the one I installed with CygWin works. And the same command is also working in Ubuntu. Which basically indicates that your command itself is OK.
If you are working on Windows, I recommend you to use a tool called Fiddler. It can perform almost all HTTP requests you may need. Good luck!
Update:
Here I add the steps to make HTTP POST request with Fiddler.
1) After starting Fiddler, you will see the GUI like Figure 1. The upper right panel is where you should input staff like JIRA's website, request type, and the content you want to post. To be specific, under the "Composer" tab, you need to select "POST" as your request type, and put the JIRA's URL there, keep HTTP/1.1 selected. You should put the request header under the URL bar. Now, you need to pay attention to. At least, you should input two things in HTTP header: the content type, which is "application/json", and the authorization header. The authentication is a Base64 string, you can get your Base64 string here with your "admin:password". If you want to know more about the basic authentication method, please refer Jira's website here. The lower right panel of the GUI is where you should put your post content.
2) When you get these staff ready, you can click the "Execute" button at upper right corner of the GUI. The execution result will be shown at the left panel. As Figure 2 shows, if you get a result with the status 200, congratulations, you got it. If you get other types of results, please google the error code or leave comments here.
3) Double click the result, the returned JSON content will be shown in the lower right panel like Figure 3. You can try different tab to see the returned staff. For example, if you go to the "TextView", you will get the returned JSON as pure string.
Please comment if you have any further question.
Pls verify if you have any value wrapped with single quote.
e.g
"NetworkType": 'Test'
Try this. It should work.
curl -D- -u admin:password -X POST -H "Content-Type: application/json" --data
\\"{"jql":"project = CI","startAt":0,"maxResults":50,"fields":["summary","status","assignee"]}\\"
"https://myclientname.atlassian.net/rest/api/2/search"
Don't forget to use a slash (\*{}\*}after and before json
This worked for me:
curl.exe -u elastic:Password! -k -X POST "https://localhost:9200/_security/user/kibana_system/_password?pretty" -H "Content-Type: application/json" --data '{"""password""" : """CHANGEME"""}'
Notice the format of the last parameter (--data): it uses single quotes (') as string delimiters and triple double-quotes (") inside)