GoogleMaps for Qlik
December 16, 2016 | Author: Anchua | Category: N/A
Short Description
GoogleMaps for QlikView...
Description
Google map in QlikView Jedini potreban podatak u tablici je ime grada, nije potrebno unaprijed znati longitude i latitude.
1. skripte U skripti se ime grada sprema u varijablu koja se zatim koristi u linku GoogleMaps-a. Također Qlik dohvaća longitude i latitude grada i sprema kao 2 atributa koja kasnije koristi za prikaz.
CustomerTable: LOAD Quantity, Customer, City FROM C:\Users\Ana-Marija\Desktop\GoogleMaps Qlik\Customer_info.xls (biff, embedded labels, table is [Sheet1$]);
let noRows = NoOfRows('CustomerTable')-1; for i=0 to $(noRows) let a = peek('Customer',$(i),'CustomerTable'); let b = peek('City',$(i),'CustomerTable'); let c = peek('Quantity',$(i),'CustomerTable'); GeocodeResponse: LOAD status, '$(a)' as CustomerName, '$(b)' as CustomerCity, '$(c)' as CustomerQuantity, ([result/geometry/location/lat]) as latitude, ([result/geometry/location/lng]) as longitude FROM [http://maps.googleapis.com/maps/api/geocode/xml?address=$(b)&sensor=false] (XmlSimple, Table is [GeocodeResponse]); next i;
For petlja prolazi kroz sve redove tablice s gradovima i povlaci duljinu i širinu za pojedino mjesto. Zatim se definira skripta za Google Maps. // Google Maps gmap_key = ''; max_zoom_level def_zoom_level def_map_size =
Key = 14; = 7; 400;
// Variables required for calculating map var_pi180 = '=pi()/180'; var_lat_offset = '0'; var_mc2 = '=256*pow(2,$(var_zoom))'; var_mc1 = '=256*pow(2,($(var_zoom)-1))'; var_mid_lat = '=median(latitude)'; var_mid_long = '=median(longitude)'; var_zoom = '=if(max(aggr(if(max(round(256*pow(2,(_zoom_level1)))+(Longitude*((256*pow(2,_zoom_level))/360)))-min(round(256*pow(2,(_zoom_level1)))+(Longitude*((256*pow(2,_zoom_level))/360)))
View more...
Comments