What is the encoding of the data attribute in the new Google Maps?

前端 未结 1 1017
孤街浪徒
孤街浪徒 2021-02-05 16:03

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

1条回答
  •  旧巷少年郎
    2021-02-05 16:49

    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:

    
    

    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 !.
    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 !m 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.

    0 讨论(0)
提交回复
热议问题