如何使用api在Google地图中仅显示一个国家/地区或特定区域?

时间:2022-11-05 15:16:28

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.

我在一个项目中使用谷歌地图,我想在我的地图窗口中只显示一张国家地图,即我只希望美国在我的地图上显示的不是Canda和墨西哥等等,切断了我的应用程序的超级信息建造。

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.

我找到了一些你可以限制一些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.

此外,我受时间限制,$,php和javascript因此我无法真正做一些涉及大量工作的花式定制解决方案,即通常的设置。

1 个解决方案

#1


12  

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

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

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 ;)).

如果你想要一些区域不可见,试试这个:我认为这最接近你想要的(这个例子实际上做了你想要的同样的东西,但它似乎面向加拿大人;))。

#1


12  

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

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

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 ;)).

如果你想要一些区域不可见,试试这个:我认为这最接近你想要的(这个例子实际上做了你想要的同样的东西,但它似乎面向加拿大人;))。