16

The new Google Maps have URLs that look like this:

https://www.google.com/maps/search/coffee/@37.0625,-95.677068,4z/data=!3m1!4b1

Obviously the search term is "coffee" and @37.0625,-95.677068,4z is the lat, lng and zoom; but what is data? I.e. what encoding is !3m1!4b1?

jeteon
  • 3,471
  • 27
  • 40
Daniel Dimitrov
  • 1,848
  • 21
  • 35
  • 4
    Check out article about the url format of the new google maps: http://moz.com/blog/new-google-maps-url-parameters – nemesv Jul 06 '14 at 12:29
  • 1
    Thanks for this link! It definitely shines some light on the issue, but ti still doesn't answer what is this for encoding. In the background gmaps is sending hundreds of requests like this: https://www.google.com/maps/vt/pb=!1m4!1m3!1i2!2i0!3i1!2m3!1e0!2sm!3i267096279!3m4!2sen!5e1105!12m1!1e47!4e1!5m4!1e4!8m2!1e0!1e1!6m15!1e3!2i11!16e1!19m4!1e1!2e0!4m1!1e0!20m4!1e1!2e3!3m1!1e0!30m1!1f1.1320754289627075!7s!20m1!1b1 and I really would like to know what it is all supposed to mean. – Daniel Dimitrov Jul 07 '14 at 07:43
  • 1
    It is protobuf according to [this blog post](https://medium.com/@marin_m/how-i-found-a-5-000-google-maps-xss-by-fiddling-with-protobuf-963ee0d9caff) which goes far to decypher and manipulate it. – Curiosa Globunznik Feb 11 '21 at 22:35

1 Answers1

31

I've never seen this encoding, I guess it's something proprietary by Google. There are some hints about the structure though. I clicked on "embed" and got a longer url, with the same syntax:

<iframe src="https://www.google.com/maps/embed?pb=!1m12!1m8!1m3!1d26081603.294420473!2d-95.677068!3d37.0625!3m2!1i1024!2i768!4f13.1!2m1!1scoffee!5e0!3m2!1sde!2s!4v1404930797899" width="600" height="450" frameborder="0" style="border:0"></iframe>

The ! char is quite likely a separator. For better readability, some line breaks:

https://www.google.com/maps/embed?pb=
!1m12
!1m8
!1m3
!1d26081603.294420473
!2d-95.677068
!3d37.0625
!3m2
!1i1024
!2i768
!4f13.1
!2m1
!1scoffee
!5e0
!3m2
!1sde
!2s
!4v1404930797899

The pattern seems to be !<id><data type><value>.
Some of the data types we see here: s is a string, b is boolean, i is integer, d is double, f float.

Now this is just a guess, but I think m is a container and there is the pattern that !<id>m<X> is followed by X parameters. This way similiar values are grouped, the IDs are unique and in ascending order on each level:

!1m12
  !1m8
    !1m3
      !1d26081603.294420473
      !2d-95.677068
      !3d37.0625
    !3m2
      !1i1024
      !2i768
    !4f13.1
  !2m1
    !1scoffee
  !5e0
!3m2
  !1sde
  !2s
!4v1404930797899

Another example, after clicking on a random coffee shop. I've tried to identify some of the values.

!1m14
  !1m8
    !1m3
      !1d3101.011519367493   // zoom level
      !2d-94.59454913903049  // longitude
      !3d38.99223345944582   // latitude
    !3m2
      !1i1024                // looks like some screen resolution,
      !2i768                 // but never changes
    !4f13.1
  !3m3
    !1m2
      !1s0x0%3A0xaf8a57446f312899
      !2sOne+More+Cup        // business name that I clicked
  !5e0
!3m2
  !1sde                      // language (german)
  !2s
!4v1404933052643             // timestamp

So if this is somewhat right, your example !3m1!4b1 is a boolean value.

kapex
  • 28,903
  • 6
  • 107
  • 121
  • 1
    I created a basic Javascript Gist based on your answer to parse the "data" attribute value into an `Array`: https://gist.github.com/jeteon/e71fa21c1feb48fe4b5eeec045229a0c – jeteon Sep 20 '16 at 21:20
  • 1
    What about this place, how do you get the GPS coordinates for it? `https://www.google.com/maps/place/@/data=!4m2!3m1!1s0x88c2cdd22ab04385:0xf12ec367be629fbc` – user3248578 Jul 29 '19 at 15:17
  • @TruthSeeker I think that URL only contains the ID of the place but not the actual coordinates. After loading the map, the URL actually changes for me after a few seconds and then the new URL contains the coordinates. – kapex Jul 29 '19 at 22:14
  • 1
    @kapex, I found out there is an undocumented API to convert the hexadecimal values check it out: https://stackoverflow.com/questions/47017387/decoding-the-google-maps-embedded-parameters – user3248578 Jul 30 '19 at 03:15
  • Is true that 2d and 3d are longitude and latitude, but not from the location we want but for calculating de positioning of the map. – Saiyine Jan 15 '21 at 12:15
  • 1
    What is `!5e0` stands for? – Sisir Jul 26 '21 at 20:55
  • @Sisir Maybe 'e' stands for 'enum' and the '0' is the enum value? But that's really just a guess. It's hard to tell what its for – kapex Jul 27 '21 at 09:14