Fixing location for the scatter map plugin [Linux]
Sometimes we can see that the dot in the Scatter map, should be f.e. In the USA but it appears in Mexico. How to fix such an issue?
Step-by-Step Guide:
For example, we are trying to find a location by ZIP 83128, which belongs to Alpine, WY, USA.
The Scatter map shows it in Hermosillo, Sonora, 83128, Mexico.
To check this behaviour, we can go to Admin - REST API - 1.0 - geo - POST /geo/location
Press the "Try it out" button & insert the following JSON code:
{
"locations": [
{
"lookupKey": "83128"
}
],
"geoLevel": "zip"
}
Press the Execute button, and we will get the next reply.
This happened because Scatter Map was trying to find the first match.
It can be improved by adding additional fields to the widget location field, f.e, State or Country field.
Also we can improve this in the DB, especially if it is important for you to use this configuration of the widget.
To do this go to Admin - REST API - 1.0 - geo - POST /geo/location
Press Try it out button. Insert the following JSON code:
{
"locations": [
{
"lookupKey": "83128, WY"
}
],
"geoLevel": "zip"
}
As you can see we added to the request an additional parameter, WY (state) that should help us find the correct location.
Press Execute button.
Now we've got the other result that we expected to see for this ZIP code.
Copy this reply to Notepad.
Run POST /geo/location
Press Try it out button. Insert the following JSON code:
{
"locations": [
{
"lookupKey": "83128"
}
],
"geoLevel": "zip"
}
And copy _id from it (f.e.: "_id": "689be14788b32750f1f7d586", )
Go to PATCH /geo/locations, press Try it out button. Paste our JSON code to Parameters - Description.
Add on the beginning of the text
{
"locations":
And to the end:
}
Change the _id to the one we copied before - 689be14788b32750f1f7d586 and lookupKey to 83128.
So you will get the following code:
{
"locations": [
{
"_id": "689be14788b32750f1f7d586",
"lookupKey": "83128",
"context": [
{
"id": "place.5490924",
"mapbox_id": "dXJuOm1ieHBsYzpVOGpz",
"wikidata": "Q1028044",
"text": "Alpine"
},
{
"id": "district.13657836",
"mapbox_id": "dXJuOm1ieHBsYzowR2Jz",
"wikidata": "Q484527",
"text": "Lincoln County"
},
{
"id": "region.50412",
"mapbox_id": "dXJuOm1ieHBsYzp4T3c",
"wikidata": "Q1214",
"short_code": "US-WY",
"text": "Wyoming"
},
{
"id": "country.8940",
"mapbox_id": "dXJuOm1ieHBsYzpJdXc",
"wikidata": "Q30",
"short_code": "us",
"text": "United States"
}
],
"err": null,
"latLng": {
"lat": 43.163088,
"lng": -111.018808
},
"name": "83128",
"place_name": "Alpine, Wyoming 83128, United States",
"placetype": [
"zip",
"postcode"
],
"properties": {
"mapbox_id": "dXJuOm1ieHBsYzpFTzhPN0E"
},
"text": "83128",
"version": "6.0"
}
]
}
Press the Execute button.
Now let's check the result.
Go to geo - POST /geo/location
Press the "try it out" button. Insert the following JSON code:
{
"locations": [
{
"lookupKey": "83128"
}
],
"geoLevel": "zip"
}
Press the Execute button, and we should get the correct result.
Conclusion:
Be careful with mass changing; maybe in this case, it is better to contact the support team.
Disclaimer: This post outlines a potential custom workaround for a specific use case or provides instructions regarding a specific task. The solution may not work in all scenarios or Sisense versions, so we strongly recommend testing it in your environment before deployment. If you need further assistance with this, please let us know.