没有 Google 图层的 MKMapView

发布于 2024-10-16 21:44:20 字数 195 浏览 2 评论 0原文

使用 MKMapView 时是否有某种方法可以禁用 Google 图层?我打算自己提供所有瓷砖。

目前我看到的方式是我必须选择我的地图使用哪种类型的谷歌数据,但没有办法完全关闭它。

更新 只是重申一下。我根本不希望我的应用程序联系 Google。不应收到任何地图图像,因此我认为我不是他们许可协议的一时兴起。

Is there some way to disable the Google layers when using a MKMapView? I intend to supply all the tiles myself.

The way I see it at the moment I have to pick which type of Google data my map uses but no way to turn it off altogether.

Update
Just to reiterate. I don't want my app to contact Google at all. No map imagery should be received, therefore I'd like to think I'm not at the whim of their license agreement.

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

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

发布评论

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

评论(5

尘世孤行 2024-10-23 21:44:20

从 iOS 7 开始,这很容易做到。此代码(您可以将其放置在 viewDidLoad: 方法中)将在应用程序包的 map-tiles/ 文件夹中查找图块:

NSString *baseURL = [[[NSBundle mainBundle] bundleURL] absoluteString];
NSString *template = [baseURL stringByAppendingString:@"map-tiles/{z}/{x}/{y}.png"];
MKTileOverlay *overlay = [[MKTileOverlay alloc] initWithURLTemplate:template];
overlay.canReplaceMapContent = YES;
[self.mapView addOverlay:overlay level:MKOverlayLevelAboveLabels];

此页面详细介绍了如何下载 OpenStreetMap 切片以供离线使用。

As of iOS 7, this is now very easy to do. This code (which you can place in your viewDidLoad: method) will look for tiles in the map-tiles/ folder in the app bundle:

NSString *baseURL = [[[NSBundle mainBundle] bundleURL] absoluteString];
NSString *template = [baseURL stringByAppendingString:@"map-tiles/{z}/{x}/{y}.png"];
MKTileOverlay *overlay = [[MKTileOverlay alloc] initWithURLTemplate:template];
overlay.canReplaceMapContent = YES;
[self.mapView addOverlay:overlay level:MKOverlayLevelAboveLabels];

This page has details on how to download OpenStreetMap tiles for offline usage.

百思不得你姐 2024-10-23 21:44:20

这是 Google API 许可协议的一部分。

您永远无法隐藏他们的徽标、标签或图像。

即使您设法使用私人课程来做到这一点,我向您保证您的应用程序也会被拒绝。

您唯一能做的就是添加覆盖层和图钉。

祝你好运!

This is part of the Google API License Agreement.

You can not, ever, hide their Logo, labels or images.

Even if you manage to do this using private classes I assure you your app will be rejected.

The only thing you can do is add overlays and pins.

Good luck!

爱要勇敢去追 2024-10-23 21:44:20

我认为克雷格的问题更多的是“是否有一个类似 MKMapView 的控件,我可以用它来显示我自己的地图和地图图块,它可以完成 MKMapView 所做的所有事情(处理从“我的房子”到“整个星球”的缩放,动画滚动到特定的纬度/经度坐标等),但使用我的内容?”

...答案是否定的,或者至少苹果不提供除 MKMapView 之外的“地图”控件,并且在不使用 Google 地图的情况下无法使用 MKMapView。您必须从 UIScrollView 的子类开始并编写自己的方法,或者研究第三方 SDK 来显示地图。

I think Craig's question is more "is there an MKMapView-like control that I can use to display my own maps and map tiles, which does all the things MKMapView does (handles zooming from "my house" to "entire planet", animates scrolling to a specific lat/lon coordinate, etc.), but uses my content instead?"

...and the answer is no, or at least that Apple doesn't provide "map" controls other than MKMapView, and there's no way to use MKMapView without using Google Maps. You'd have to start with a subclass of UIScrollView and write your own methods, or look into third-party SDKs for displaying maps.

抚笙 2024-10-23 21:44:20

如果您反对使用 MKMapView 类,因为它基于 Google 数据,那么我建议您查看 CloudMade 作为替代地图提供商。他们有自己的 SDK 和 UI 控件,非常易于使用。

If you're objection to using the MKMapView class is that it's based on Google data then I'd recommend checking out CloudMade as an alternative map provider. They have their own SDK and UI controls which are extremely easy to use.

浸婚纱 2024-10-23 21:44:20

我已经在另一个 stackoverflow 问题中回答了这个问题。

虽然更准确地说,它不会阻止 Google 调用(它们很可能仍然会进行,因为解决方案涉及更改绘图行为),但您不会看到图块。

希望它能帮助你。

I've answered this question on another stackoverflow question.

Though to be more precise, it doesn't prevent the Google Calls (they are most likely still made because the solution involves changing the drawing behavior) but you will not see the tiles.

Hope it'll help you.

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