Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
krish2459
Creator
Creator

50 km radius in qliksense maps

Hi,

I'm aving a map as below and when when i click on site(red dot) the map should zoom into 50 km radius.

 

Let me know how to get this.

 

krish2459_0-1597392390259.png

 

Thanks...

 

14 Replies
JesseRobby
Contributor
Contributor

Steven,

Where would you enter the above formula (in the Store ID layer or Cust ID layer)?

Secondly do I define the variable as 

LET vLAT = "Store Latitude";
LET vLONG = "Store Longitude";

Finally when I type the following formula I receive an "Error in expression"

Error in expression: ')' expected

I used the excel file that was provided by Krish2459 to load data in Qlik Sense

If(GetSelectedCount([Store ID])>0,
IF(Round(ACOS(SIN([Customer Lattude]*Pi()/180)*SIN($(vLAT)*Pi()/180)+COS([Customer Lattude]*Pi()/180)
*COS($(vLAT)*Pi()/180)*COS(($(vLONG)*Pi()/180)-([Customer Longitude]*Pi()/180)))*3963)
<=31.07
,[Cust ID])
,[Cust ID])

 

 

Steven_Haught
Creator III
Creator III

@JesseRobby 

If you are using Krish's Data the fields were backwards. The vLat and vLong need to be the Customer ID. If your data is correct it would be the Store lat/long. I don't generally create my variables in the load. So the Let vs Set by coming into play there area. What you want is for it to place the value of the single selection of the field in your variable. 

With the formula, that is placed in the dimension of the customer ID layer. It should be working in there, I copy and pasted yours right into mine without error. Reminder here that the Fields are backwards in Krish's data and where you have Customer Lat or Long needs to be Store Lat/Long. 

Steven_Haught
Creator III
Creator III

Two other options to help optimize this a bit more: 

1. Adjust the draw order in layer options for the Store ID layer to be non auto and set to 1. This will allow that layer to always display above your other points. 

2. With this example there were 1000s of customers, which is likely normal in any case use of this. You can set this layer to not display at all until you select a store by using the calculation condition: 

IF( GetSelectedCount([Store ID])>0, 1,0)

This helped the performance of the app display tremendously. 

JesseRobby
Contributor
Contributor

@Steven_Haught 

 Removed the variable from the data  load as suggested. Formula was placed in the Customer ID layer and worked perfectly with no errors. Also introduced a variable for the radius, so end user can set a distance of choice.

thank you!

Steven_Haught
Creator III
Creator III

@JesseRobby Great to hear. Also like the addition of the variable for the distance, have done the same in a personal version of this! Glad this worked for you!