如何使用api在Google地图中仅显示一个国家或特定区域? [英] How to display only one country or a specific area in Google maps using the api?

查看:83
本文介绍了如何使用api在Google地图中仅显示一个国家或特定区域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个项目中使用 Google 地图,我只想在我的地图窗口中显示一个国家地图,即我只想在我的地图上显示美国,而不是加拿大和墨西哥等,从而去掉了我正在构建的应用程序.

I am using Google Maps in a project and I want to display only a country map in my map window i.e. I want only the US to show on my map not Canda and Mexico and so on, cutting away the superflous information for the app I am building.

我发现了一些东西,你可以限制一些 javascript 覆盖的区域,但是这仍然给了我很多额外的地图区域,因为地理区域通常不符合正方形.

I found some stuff where you can restrict the area covered with some javascript however this still gives me a lot of extra map area as geographic areas usually do not conform to squares.

此外,我受到时间、$、php 和 javascript 的限制,因此我无法真正做一些涉及大量工作的奇特自定义解决方案,即通常的设置.

Further on I am limited by time, $, php and javascript so I can't really do some fancy custom solution that involves lots of work i.e. the usual setting.

推荐答案

查看 Mike Williams 之一'很棒的 GMaps 教程:在那里,他展示了如何限制地图中的缩放和平移.

Check out one of Mike Williams' great GMaps tutorials: in there, he shows how to limit zoom and pan in your map.

如果您希望某些区域不可见,试试这个:我认为这最接近您想要的(example 实际上与您想要的一样,但是它似乎是针对加拿大人的;))

If you want some areas to be non-visible, try this one: I think that's closest to what you want (the example actually does the same thing you want, but it seems to be geared towards Canadians ;)).

这篇关于如何使用api在Google地图中仅显示一个国家或特定区域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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