Detect whether a coordinate or zone intersects with water layer
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 40/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 领域
- api, mobile-dev
调研方向
从 issue 正文中的 _zoneContainsWater 以及其中展示的 queryRenderedFeatures、pixelForCoordinate、RenderedQueryGeometry.fromScreenBox 和 RenderedQueryOptions 调用开始。验证返回的 layer 和 feature 如何表示水,以及 bounding-box 查询是否符合坐标或区域相交语义。完成的标准是水域返回 true,纯陆地区域返回 false,并按所示方式处理查询错误。
由索引模型根据 Issue 内容生成。
描述
Currently, I am trying to determine whether a coordinate lies on water by querying the rendered features of the water layer using queryRenderedFeatures.
` Future _zoneContainsWater(
double centerLat,
double centerLon,
double radiusNM,
) async {
if (mapboxMap == null) return false;
try {
// Calculate Bounding Box coordinates for the zone (NW and SE corners)
final dLat = radiusNM / 60.0;
final latCos = cos(centerLat * pi / 180.0);
final dLon = latCos.abs() < 0.0001 ? dLat : dLat / latCos;
final nLat = centerLat + dLat;
final sLat = centerLat - dLat;
final wLon = centerLon - dLon;
final eLon = centerLon + dLon;
// Convert those geographic corners to screen pixels
final nw = await mapboxMap!.pixelForCoordinate(mapBox.Point(coordinates: mapBox.Position(wLon, nLat)));
final se = await mapboxMap!.pixelForCoordinate(mapBox.Point(coordinates: mapBox.Position(eLon, sLat)));
// Perform a query across the entire zone's bounding box
final result = await mapboxMap!.queryRenderedFeatures(
mapBox.RenderedQueryGeometry.fromScreenBox(mapBox.ScreenBox(
min: mapBox.ScreenCoordinate(x: min(nw.x, se.x), y: min(nw.y, se.y)),
max: mapBox.ScreenCoordinate(x: max(nw.x, se.x), y: max(nw.y, se.y)),
)),
mapBox.RenderedQueryOptions(
// Ensure we target our manually added 'water' layer + any style-detected ones
layerIds: ["water", ..._waterLayerIds],
),
);
developer.log("Zone query found ${result.length} features in targeted water layers");
for (var queried in result) {
if (queried != null) {
final layers = queried.layers;
final featureMap = queried.queriedFeature.feature;
final properties = featureMap["properties"] as Map?;
print("Water Feature Match: $layers, properties: $properties");
bool layerMatch = layers.any((layer) =>
layer != null &&
(layer.toLowerCase().contains("water") || layer.toLowerCase().contains("ocean") || layer.toLowerCase().contains("lake") || layer.toLowerCase().contains("sea")));
bool propertyMatch = properties != null && (properties["class"] == "water" || properties["type"] == "water" || properties["water"] == "true");
if (layerMatch || propertyMatch) {
developer.log("WATER CONFIRMED inside Zone Box!");
return true;
}
}
}
} catch (e) {
developer.log("Error querying zone box for water: $e");
}
return false; // No water features found within the 2*Radius area
}`
- 主要语言
- Dart
- 星标
- 380
- 派生
- 204
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
mapbox/mapbox-maps-flutter 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 45/100
mapbox/mapbox-maps-flutter#1144 ·
-
iOS: the map cannot be captured or read by flutter, because it is a platform view可能已有人在做 @Nixxx19 于 50 天前认领。 未关闭
难度 5/5 一周以上 新手友好度 25/100
mapbox/mapbox-maps-flutter#1142 ·
-
难度 3/5 1-2 天 新手友好度 58/100
mapbox/mapbox-maps-flutter#1140 ·
-
Normalize ornament positioning relative to safe areas on iOS and Android可能重新可做 @maios 于 94 天前认领,目前没有进行中的 PR。 未关闭
mapbox/mapbox-maps-flutter#1137 · 1 条评论 · 1 个 reaction · 已指派 1 人 ·
-
难度 3/5 1-2 天 新手友好度 48/100
mapbox/mapbox-maps-flutter#1136 · 1 条评论 ·
查看 mapbox/mapbox-maps-flutter 的全部 Issue
相似的 Issue
-
area: ui feature priority: medium
难度 1/5 1 小时以内 新手友好度 90/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 63/100
AimesSoft/NipaPlay-Reload#1022 ·
维护者通常 1 天内回复
-
`jwtPayload.roomConfiguration` returns null fields for tokens from LiveKit server SDKs可能已有人在做 @RaphaelFakhri 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
livekit/client-sdk-flutter#1243 ·
维护者通常 1 天内回复
-
bug to check
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
zjs81/meshcore-open#602 · 3 条评论 ·
维护者通常 1 天内回复