Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set map size in Google Maps API v3?

Tags:

google-maps

I create a map in a div with 'display: none'. With google maps v2 I could set the 'size' parameter to the size of the div once shown, but this 'size' option disappeared in v3 of the API.

How can I do that?

like image 626
jul Avatar asked Oct 04 '10 11:10

jul


People also ask

How do you change the size of Google Maps?

To change the map scale units used on the Google Maps desktop website on your Windows 10 PC or Mac, click the scale bar in the bottom-right corner. Selecting the scale bar will switch to the other measurements, allowing you to quickly view the map scale in miles, kilometers, or relevant smaller units.

How do I change the map in Google Maps API?

You modify the map type in use by the Map by setting its mapTypeId property, either within the constructor via setting its Map options object, or by calling the map's setMapTypeId() method.

Can you customize Google Maps API?

Create a map with the Google Maps API.Google Maps Platform gives you the ability to create a truly custom map that works exactly how you want it to.

Is the largest image size allowed in Static Maps API?

Static Maps images can be returned in any size up to 640 x 640 pixels. If you need images with sizes larger than 640 x 640 pixels (or 640 x 640640 x 640 pixels with a scale value of 2), follow these steps.


1 Answers

Change the size of the div using any method you want, and then call google.maps.event.trigger(map, 'resize'). A related question is here.

like image 101
Sudhir Jonathan Avatar answered Oct 04 '22 15:10

Sudhir Jonathan