MapBox是否可以检测坐标是否在水体上? [英] MapBox ability to detect if coordinates is on a body of water?

查看:116
本文介绍了MapBox是否可以检测坐标是否在水体上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,MapBox允许下载离线区域.好吧,下载太平洋地区的离线区域并没有任何意义.我收到了来自质量检查部门的罚单,目的是至少防止用户在所请求的坐标位于水域上时下载任何内容(如果是河流,瀑布或下水道理就没关系了).我必须防止用户意外下载主要由水域组成的离线区域(主要是海洋).

First of all, MapBox allows downloading off-line region. Well, downloading off-line region for the Pacific ocean doesn't really make sense. I was sent a ticket coming from the QA department to at least prevent user from ever downloading anything when the coordinates requested is on a body of water (doesn't really matter if it is a river, waterfalls, sewage what not). I have to prevent user accidentally downloading off-line regions that mostly composed of body of water (mostly oceans or seas).

我正在为用户群为海员的客户创建一个应用程序,而下载离线区域的成本可能很高.所以我的问题是MapBox是否能够使用

I am creating an application for a client whose user base are seafarers and downloading off-line region can be costly. So my question is MapBox capable of detecting this without me ever using this hack?

谢谢!

推荐答案

您可以直接查询地图图块,而无需进行API调用.例如,如果要检查用户中心视口点.

You can query the map tiles directly without the need to make an API call. An example doing this is if you want to check the users center view port point.

LatLng center = mapboxMap.getCameraPosition().target;
final PointF pixel = mapboxMap.getProjection().toScreenLocation(center);
List<Feature> features = mapboxMap.queryRenderedFeatures(pixel, "water");

如果用户当前正在注水,则它将返回至少一个大小为1的要素列表,否则,大小为0.

This will return a list of features with at least a size of 1 if the users currently looking at water, otherwise, it will have a size of 0.

请注意,您也可以考虑整个视口区域或与此相关的任何边界框区域来执行此操作.

Note that you can also do this considering the entire viewport area or any bounding box region for that matter.

这篇关于MapBox是否可以检测坐标是否在水体上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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