qv esri map approach malisetty (2)
DESCRIPTION
business intelligenceTRANSCRIPT
Page 1 of 12
Prasad Malisetty - Aug 2012
Incorporating ESRI Maps (ArcGIS) into Qlikview
The fact table should have a connection to latitude and longitude data. A typical example is below, where the fact table
contains the Zipcode and another table will contain the latitude and longitude data for each zip code. Qlikview requires
the latitude and longitude data to plot on a map.
Variables:
max_zoom_level
17
var_lat_offset
0
var-zoom =max(aggr(if(max( round(256*pow(2,(_zoom_level -1)))+( longitude *((256*pow(2,_zoom_level ))/360))
)-min( round(256*pow(2,(_zoom_level -1)))+( longitude *((256*pow(2,_zoom_level ))/360)) )
<map_size_x AND max((256*pow(2,(_zoom_level-1)))+((0.5*log((1+(sin((latitude)*pi()/180)))/(1-
(sin((latitude)*pi()/180)))))*((-256*pow(2,_zoom_level))/(2*pi()))))-min((256*pow(2,(_zoom_level-
1)))+((0.5*log((1+(sin((latitude)*pi()/180)))/(1-(sin((latitude)*pi()/180)))))*((-
256*pow(2,_zoom_level))/(2*pi()))))<map_size_y,_zoom_level,1),_zoom_level))
Page 2 of 12
Prasad Malisetty - Aug 2012
var_mid_lat =min(latitude)+(1+var_lat_offset)*((max(latitude)-min(latitude))/2)
var_mid_long =min(longitude)+(max(longitude)-min(longitude))/2
map_size_x
640
Note: set this to any size we want
map_size_y
480
Note: set this to any size we want
HidePrefix
_
_zoom_level
Load RecNo( ) as _zoom_level autogenerate(max_zoom_level);
z_x_min = (256*pow(2,((var_zoom)-1)))+( var_mid_long *((256*pow(2,(var_zoom)))/360)) -round(map_size_x/2)
z_y_min =-((256*pow(2,((var_zoom)-1)))+((0.5*log((1+(sin(var_mid_lat*pi()/180)))/(1-
(sin(var_mid_lat*pi()/180)))))*((-256*pow(2,(var_zoom)))/(2*pi())))+ round(map_size_y/2))
z_x_max =z_x_min + map_size_x
z_y_max =z_y_min + map_size_y
z_x_min_use = ( 360*z_x_min - (360*256*pow(2,((var_zoom)-1)))) / ( (256*pow(2,(var_zoom))))
z_y_min_use = (180* asin( ((exp(z_k_min)) - 1) / ((exp(z_k_min)) + 1)) / pi() )
z_k_max = 2 * (-z_y_max -(256*pow(2,((var_zoom)-1)))) / ( (-256*pow(2,(var_zoom)))/(2*pi()))
z_k_min = 2 * (-z_y_min - (256*pow(2,((var_zoom)-1)))) / ( (-256*pow(2,(var_zoom)))/(2*pi()))
z_x_max_use = ( 360*z_x_max - (360*256*pow(2,((var_zoom)-1)))) / ( (256*pow(2,(var_zoom))))
z_y_max_use = (180* asin( ((exp(z_k_max)) - 1) / ((exp(z_k_max)) + 1)) / pi() )
Page 3 of 12
Prasad Malisetty - Aug 2012
vMapURL ='http://$(vMapIP)/arcgis/rest/services/$(vMapService)/MapServer/export?BBOX=$(z_x1),$(z_y1),$(z_x2
),$(z_y2)&bboxSR=&layers=&layerdefs=&size=$(map_size_x),$(map_size_y)&imageSR=$(vImageSR)&format=jp
g&transparent=false&dpi=&time=&layerTimeOptions=&f=image'
vMapIP server.arcgisonline.com
vMapService World_Street_Map
vImageSR
0
z_x1 =z_x_min_use*(pi()/180)*z_constant
z_constant 6378137
z_y1 = z_constant*log(tan((z_y_min_use*(pi()/180))/2 + (pi()/4)))
z_y2 = z_constant*log(tan((z_y_max_use*(pi()/180))/2 + (pi()/4)))
z_x2 =z_x_max_use*(pi()/180)*z_constant
Step1:
Create a new chart – as a scatter chart
Page 4 of 12
Prasad Malisetty - Aug 2012
Step2:
Dimensions
Page 5 of 12
Prasad Malisetty - Aug 2012
Step3:
Page 6 of 12
Prasad Malisetty - Aug 2012
Step4:
Page 7 of 12
Prasad Malisetty - Aug 2012
Longitude =sum( round (256*pow(2,($(var_zoom)-1)))+( (longitude) *((256*pow(2,$(var_zoom)))/360)) )
Latitude =sum(
((256*pow(2,($(var_zoom)-1)))+((0.5*log((1+(sin((latitude)*pi()/180)))/(1-
(sin((latitude)*pi()/180)))))*((-256*pow(2,$(var_zoom)))/(2*pi())))))
Step:
Page 8 of 12
Prasad Malisetty - Aug 2012
Step:
Page 9 of 12
Prasad Malisetty - Aug 2012
Step:
Page 10 of 12
Prasad Malisetty - Aug 2012
X Axis – Scale
Static MIN (256*pow(2,($(var_zoom)-1)))+( var_mid_long *((256*pow(2,$(var_zoom)))/360)) -round(map_size_x/2)
Static MAX ( (256*pow(2,($(var_zoom)-1)))+( var_mid_long *((256*pow(2,$(var_zoom)))/360)) +
round(map_size_x/2))
Y Axis – Scale
Static MIN =((256*pow(2,($(var_zoom)-1)))+((0.5*log((1+(sin(var_mid_lat*pi()/180)))/(1-
(sin(var_mid_lat*pi()/180)))))*((-256*pow(2,$(var_zoom)))/(2*pi())))+round(map_size_y/2))
Static MAX =((256*pow(2,($(var_zoom)-1)))+((0.5*log((1+(sin(var_mid_lat*pi()/180)))/(1-
(sin(var_mid_lat*pi()/180)))))*((-256*pow(2,$(var_zoom)))/(2*pi())))-round(map_size_y/2))
Page 11 of 12
Prasad Malisetty - Aug 2012
Step:
Note the Dynamic Image selection in the Colors tab pointing to vMapURL. This is what shows the map background.
Step:
Page 12 of 12
Prasad Malisetty - Aug 2012