Page 1 of 1

How to set the map type?

Posted: Thu Jan 09, 2014 9:38 pm
by Michael2210441

I created the map object and gave it the custom property of 'maptype' and give it any of the values google lists, but it does not change the default map type that loads.

What am I doing wrong?


How to set the map type?

Posted: Thu Jan 09, 2014 10:30 pm
by Michael2210441

I found this suggestion: https://getsatisfaction.com/apperyio/topics/set_google_map_to_default_to_satellite_view_with_displayed?#reply_12220787

so I changed my refresh code on the success event to:
pre
var map = Appery('map');
map.options['address']='';
map.gmap.mapTypeId = google.maps.MapTypeId.SATELLITE;
map.refresh();
/pre

Now I see the satellite image flash before it's replaced with the default.


How to set the map type?

Posted: Thu Jan 09, 2014 10:31 pm
by Alena Prykhodko

Hello Michael,

This can be done with JS:
pre
var mapOptions = {
center: new google.maps.LatLng(-34.397, 150.644),
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(Appery("mapName").get(0), mapOptions);
/pre


How to set the map type?

Posted: Thu Jan 09, 2014 10:34 pm
by Michael2210441

Is it required to use the center and zoom params with? I currently have latitude and longitude mapped directly from the return to the map object.


How to set the map type?

Posted: Thu Jan 09, 2014 10:59 pm
by Michael2210441

Thanks Alena,

I got your suggestion working by just changing my approach a little...

pre
var mapOptions = {
center: new google.maps.LatLng(localStorage.getItem("lat"), localStorage.getItem("long")),
zoom: 6,
mapTypeId: google.maps.MapTypeId.SATELLITE
};
var map = new google.maps.Map(Appery("map").get(0), mapOptions);

map.options['address']='';
map.gmap.mapTypeId = google.maps.MapTypeId.SATELLITE;
map.refresh();
/pre

Thanks!