[英]How do you use q (querystring) and z (zoom) when trying to zoom in on a Google maps (using JavaScript) on a mobile device?
I have written a media query in JavaScript that allows you to zoom (z) in on google maps mobile. 我已经用JavaScript编写了媒体查询,可让您在Google Maps Mobile上进行放大(z)。 I have also written a querystring (q) that allows you to enter an address or postcode.
我还写了一个查询字符串(q),可让您输入地址或邮政编码。 Both work when used individually.
两者单独使用时都可以工作。 However, now I want to zoom (z) in on a given querystring (q) on Google maps (mobile devices), is this possible?
但是,现在我想在Google地图(移动设备)上放大给定查询字符串(q)(z),这可能吗? And if it is how would I write the code for this?
如果是的话,我该如何编写代码?
Yes, you are right, you cannot just give a q
and z
to the Google Maps, you also need the query ll
, which stand for Latitude and Longitude of the center of the map, in order for the zoom
to work with the querystring
. 是的,您是对的,您不能仅对Google Maps赋予
q
和z
,还需要查询ll
(代表地图中心的纬度和经度),以便zoom
可以与querystring
。 Also look at this example: 还要看这个例子:
https://www.google.com/maps?q=googleplex,+mountain+view,+ca&ll=37.4219999,-122.0840575&z=10 https://www.google.com/maps?q=googleplex,+mountain+view,+ca&ll=37.4219999,-122.0840575&z=10
You can use the geocoding API to get the lat/lng of your location, or you can center your map to a general area you are targeting. 您可以使用地理编码API获取位置的经度,也可以将地图中心定位到要定位的常规区域。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.