expression - 如何使用表达式过滤 Mapbox geoJSON?
问题描述
使用 mapbox 表达式并给出以下示例 geoJSON,如果许可证等于“娱乐”,我如何才能仅在地图上显示标记?在这种情况下,唯一要显示的两个位置应该是Store One
和Store Three
。
我尝试过的一些表达方式:
1.) ['in', 'Recreational', ['get', 'license' ['get', 'products']]];
2.) ['in', ['Recreational', ['get', 'license', ['get', 'products']]]];
3.) ['in', ['==', 'Recreational', ['get', 'license', ['get', 'products']]]]
{
"type": "Feature",
"properties": {
"name": "Store One",
"products”: [
{
license: “Recreational”,
product: “product name here”
},
{
license: “Medical",
product: “product name here”
}
{
license: “Recreational”,
product: “product name here”
}
]
},
"geometry": {
"type": "Point",
"coordinates": [-104.99404, 39.75621]
}
},
{
"type": "Feature",
"properties": {
"name": "Store Two",
"products”: [
{
license: “Medical",
product: “product name here”
},
{
license: “Medical,
product: “product name here”
}
{
license: “Medical,
product: “product name here”
}
]
},
"geometry": {
"type": "Point",
"coordinates": [-105.02163,39.77332]
}
},
{
"type": "Feature",
"properties": {
"name": "Store Three",
"products”: [
{
license: “Medical”,
product: “product name here”
},
{
license: “Recreational”,
product: “product name here”
}
{
license: “Medical”,
product: “product name here”
}
]
},
"geometry": {
"type": "Point",
"coordinates": [-107.811071, 37.937463]
}
}
解决方案
推荐阅读
- linux - thread_local 怎么做!在 rust 中使用动态库?
- unity3d - Unity pixelart多个精灵没有正确切割
- azure-devops - Azure DevOps 管道仅用于部署已更改的 arm 模板
- javascript - React 中的 Onclick 方法影响表格中的每个列表项,应该只影响被点击的那个
- memory-profiling - dotMemory - 快照中未列出的应用程序命名空间 - 仅是框架命名空间
- php - Wordpress:如何在页面上显示用户
- ios - 当 ObservedObject 在其他类中发生更改时如何在 ContentView 中运行方法 [Swift 5 iOS 13.4]
- swift - Curl 命令可在 CLI 上运行,但 Alamofire 无法进行身份验证
- c++ - 手动设置 cin.fail()
- php - PHP intl NumberFormatter::SPELLOUT 的源代码在哪里?