Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Using Google Maps v2 and Bing Maps

Hi,

After having gone through a high level of frustration in getting something conceptually simple such as a map working or improving its resolution, I have a couple of quick updates that might be helpful.

Google Maps Static API v2

The main advantage of switching to this is that Google has added a scale feature which now allows you to obtain maps that are up to 1200x1200 in the free version.   This is accomplished by choosing a 600x600 (maximum allowed for free) and then using a scale factor of 2.  Note the mobile type has been removed and a new field has been added for mobile so that you can get any type of map optimized for a mobile platform. 

The changes that are required from the standard mapping are as follows:

  • Add a new entry in your google maps load script:
    • map_scale=      '2'  :  Use a factor of 1 if you want  the current 1:1 scale or choose 2 if you want it to be 2X higher in resolution
    • If you choose a scale factor of 2, the X and Y resolutions must be 1/2 of what you desire, this is to maintain all the other formulas as they are
      • i.e. if you want a 400x200 resolution, choose a scale of 1 and 400x200.  If you want an 800x400 map, choose a scale of 2 and 400x200.
  • Update Chart Properties->Caption-Width & Height to the actual desired output resolution.
  • Add the following to Chart Properties->Colors->Dynamic Image:

='http://maps.googleapis.com/maps/api/staticmap?center='

&

num(var_mid_lat, '##############', '.', ',' )

&

','

&

num(var_mid_long, '##############', '.', ',' )

&

'&zoom=$(var_zoom)'

&

'&maptype='&var_maptype

&

'&size='&map_size_x&'x'&map_size_y

&

'&key='&gmap_key

&

'&sensor=false'

&

'&scale='&map_scale

Check out the documentation at http://code.google.com/apis/maps/documentation/staticmaps/ as there are other nifty features that you can add just by modifying the string above.

Using Bing Static Maps instead of Google Maps

Bing seems to have fewer restrictions on use at this time so if you are running out of views etc or want to use the competition you can try this out. 

The changes that are required from the standard mapping are as follows:

  • Add the following to Chart Properties->Colors->Dynamic Image:

='http://dev.virtualearth.net/REST/v1/Imagery/Map/CollinsBart/'

&

num(var_mid_lat, '##############', '.', ',' )

&

','

&

num(var_mid_long, '##############', '.', ',' )

&

'/'

&

'$(var_zoom)'

&

'?'

&

'mapSize='&map_size_x &','&map_size_y

&

'&format=jpeg'

&

'&key='&bmap_key

Check out the documentation at  http://msdn.microsoft.com/en-us/library/ff701724.aspx  as there are other nifty features that you can add just by modifying the string above. For example you can have other types of maps by altering the http request above and replacing 'CollinsBart' with 'Road' for example.

One feature that is missing is that the background size can't be set programmatically using a variable as that would have allowed more automation of any resolution maps.

Enjoy!

Pramod

Tags (3)
3 Replies
Not applicable

Re: Using Google Maps v2 and Bing Maps

Thank you SO much Pramod. You just helped me - and hopefully other Qlikker's :-)

http://community.qlik.com/message/245566#245566

Regards,

Messmann.

Not applicable

Re: Using Google Maps v2 and Bing Maps

Hey Team

   I am getting the map like this. I don't know how can I deal with .

I tried with the following codes... no impact.

='http://dev.virtualearth.net/REST/v1/Imagery/Map/CollinsBart/

num(var_mid_lat, '##############', '.', ',' ) 

',' 

num(var_mid_long, '##############', '.', ',' ) 

'/' 

'$(var_zoom)' 

'?' 

'mapSize='&
map_size_x &','&map_size_y 

'&format=jpeg' 

'&key='&
bmap_key 

//='http://maps.google.com/staticmap?center='
//&
//num(var_mid_lat, '##############', '.', ',' )
//&
//','
//&
//num(var_mid_long, '##############', '.', ',' )
//&
//'&zoom=$(var_zoom)'
//&
//'&maptype='&var_maptype
//&
//'&size='&map_size_x&'x'&map_size_y
//&
//'&key='& gmap_key & '&.jpg'

Kindly suggest.

   I am taking longitude and latitude  details from the excel.

qliklearnervir
New Contributor III

Re: Using Google Maps v2 and Bing Maps

Hi,

Try this

='http://maps.google.com/maps/api/staticmap?center='

&

num(var_mid_lat, '##############', '.', ',' )

&

','

&

num(var_mid_long, '##############', '.', ',' )

&

'&zoom=$(var_zoom)'

&

'&maptype='&var_maptype

&

'&size='&map_size_x&'x'&map_size_y

&

'&key='& 'AIzaSyC0xK6Tjz2HqTO1wXJ0tYaZM8AxOnNKd1U' & '&sensor=false' 

it will work...Smiley Happy

Community Browser