Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to calculate zoom URL parameter at the Google Maps Preview (new version GM)?

I need to write chrome extension which references on new version of Google Maps site.

BUT, in new google maps preview i can not give link becouse i can't calculate new zoom parameter.

For example, URL new google maps: https://www.google.com/maps/preview#!data=!1m4!1m3!1d4112402!2d-62.7728736!3d44.829016

new zoom parameter are very strange:

zoom 23 http://google.com/maps/preview#!data=!1m4!1m3!1d 1145       !2d29.6765085!3d59.868445
...
zoom 12 http://google.com/maps/preview#!data=!1m4!1m3!1d 77910      !2d29.6765085!3d59.868445
zoom 11 http://google.com/maps/preview#!data=!1m4!1m3!1d 155852     !2d29.6765085!3d59.868445
zoom 10 http://google.com/maps/preview#!data=!1m4!1m3!1d 311710     !2d29.6765085!3d59.868445
zoom 9  http://google.com/maps/preview#!data=!1m4!1m3!1d 623333     !2d29.568544!3d59.8698115
zoom 8  http://google.com/maps/preview#!data=!1m4!1m3!1d 1247028    !2d29.568544!3d59.8698115
zoom 7  http://google.com/maps/preview#!data=!1m4!1m3!1d 2493322    !2d29.568544!3d59.8698115
zoom 6  http://google.com/maps/preview#!data=!1m4!1m3!1d 4987951    !2d29.568544!3d59.8698115
zoom 5  http://google.com/maps/preview#!data=!1m4!1m3!1d 9979726    !2d29.568544!3d59.8698115
zoom 4  http://google.com/maps/preview#!data=!1m4!1m3!1d 19959453   !2d29.568544!3d59.8698115
zoom 3  http://google.com/maps/preview#!data=!1m4!1m3!1d 40027823   !2d29.568544!3d52.0636483
zoom 2  http://google.com/maps/preview#!data=!1m4!1m3!1d 80266577   !2d29.568544!3d48.7705008
zoom 1  http://google.com/maps/preview#!data=!1m4!1m3!1d 100000000  !2d29.568544!3d47.3841015
     ↑                                                       ↑           ↑            ↑     
old google                                      new zoom parameter      LAT         LONG
maps zoom                                       on Google Maps Preview
parameter                                       depends on coordinates
intuitive and easy                              how to calculate it?

This parameter depends on coordinates!

How can i generate link on new google maps with this zoom, if i know old zoom parameter (from 1 to 23)?

I think I need a new weird setting for a new function Globe... but i don't know how to compute this... google search don't know answer

If zoom parameter is bad - maps redirect to home location.

enter image description here

like image 803
user16609 Avatar asked Sep 02 '13 23:09

user16609


People also ask

How many zoom levels are there in Google Maps?

Zoom levels are between 0 (the entire world can be seen on one map) and 21+. You can also set the minimum and maximum values for the zoom parameter.


1 Answers

How about using the alternative @ syntax when linking to the maps?

Template:

https://www.google.co.uk/maps/place/@{LATITUDE},{LONGITUDE},{ZOOM}z

Example:

https://www.google.co.uk/maps/place/@29.6765085,59.868445,12z https://www.google.co.uk/maps/place/@29.6765085,59.868445,11z

like image 91
aemkei Avatar answered Nov 15 '22 07:11

aemkei