新版Google地图中data属性的编码是什么? [英] What is the encoding of the data attribute in the new Google Maps?

查看:67
本文介绍了新版Google地图中data属性的编码是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

新版Google地图具有如下网址:

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

很显然,搜索词是咖啡",而 @ 37.0625,-95.677068,4z 是lat,lng和zoom;但是什么是数据?IE.!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?

推荐答案

我从未见过这种编码,我想它是Google专有的.虽然有一些关于结构的提示.我点击嵌入"并获得了更长的网址,使用相同的语法:

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>

char很可能是分隔符.为了提高可读性,一些换行符:

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

该模式似乎是!< id><数据类型><值> .我们在此处看到的一些数据类型: s 是字符串, b 是布尔值, i 是整数, d 是双精度字, f 浮点数.

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.

现在这只是一个猜测,但我认为 m 是一个容器,并且存在!< id> m< X> 后跟 X 参数.这样,将相似的值进行分组,ID是唯一的,并且在每个级别上都按升序排列:

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

因此,如果这是正确的话,则示例!3m1!4b1 是布尔值.

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

这篇关于新版Google地图中data属性的编码是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆