Toggle Google 地图 API v3 中的图像叠加

发布于 2024-08-31 07:11:21 字数 437 浏览 3 评论 0原文

我一直在为自己建造一个小型图书馆,以完成目前为一所大学绘制地图的工作。

我已经以某种基本形式获得了我需要的一切,但有一件事根本不起作用,而且根本没有给我结果。

该大学本身与邻近的学院有某种合作伙伴关系。已决定两个校区都应包括在内。我需要能够单独打开/关闭校园的叠加层。

即从所有校区开始。然后,用户关闭大学校园,大学覆盖保持开启状态。然后,用户可以重新打开它以再次显示大学,或者也关闭大学,不留下任何覆盖。

这是我目前正在进行的一项工作: http://bgsweb.ca/maps/generator .html

基本上,我们需要将一个叠加层拆分为多个叠加层,并启用每个单独叠加层的切换。

非常感谢任何帮助!

I've been building a small library for myself for a job I have at the moment building a map for a university.

I've gotten pretty well everything I need in some basic form, but one thing has simply not been working, and is simply not giving me results.

The university itself is sort of in a partnership with the neighboring college. It's been decided that both campuses should be included. I need to be able to toggle on/off the overlays of the campuses individually.

i.e. Start with all campuses ON. User then turns OFF college campus, university overlay stays up. User can then turn it back on to display the college once more, or turn off the university as well, leaving no overlays.

Here's a work in progress I'm doing at the moment: http://bgsweb.ca/maps/generator.html

Basically, we need to take the one overlay, split it into multiple overlays, and enable the toggling of each individual overlay.

Any assistance much appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

内心荒芜 2024-09-07 07:11:21

你到底被什么困住了?

可以使用 在地图上附加或删除单个叠加层OverlayView.setMap()。要从地图中删除叠加层,只需将叠加层的地图设置为 null

overlay.setMap( null );

Exactly what are you stuck on?

Individual overlays can be attached-to or removed-from the map with OverlayView.setMap(). To remove an overlay from the map you just set the overlay's map to null

overlay.setMap( null );
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文