有没有办法在 Mapbox 静态图像 API 中设置多层过滤器?
Is there a way to set multiple layer filters in the Mapbox Static Images API?
我正在使用mapbox static images API。我的风格有两层,我试图根据请求进行过滤。文档好像只提供了一个"setfilter"和一个"layer_id"属性,说明我只能过滤其中一层。
是否可以在静态图像中过滤两层(或三层、四层)API?我希望能够在处理这种情况的请求中用逗号分隔 layer_id and/or setfilter 参数。
他们在文档中提供的用于设置过滤器的示例请求是:
https://api.mapbox.com/styles/v1/mapbox/streets-v11/static/-91,60,2/800x600?access_token=YOUR_MAPBOX_ACCESS_TOKEN&setfilter=["==","name_en","Canada"]&layer_id=country-label
我正在寻找类似的东西:
https://api.mapbox.com/styles/v1/mapbox/streets-v11/static/-91,60,2/800x600?access_token=YOUR_MAPBOX_ACCESS_TOKEN&setfilters=["==","name_en","Canada"],["==","name","New York"]&layer_ids=country-label,state-label
FWIW,我目前的解决方法是对其中一个层使用叠加层来形成我需要过滤的 geojson 对象,但它很老套,并且对我可以添加到请求中的数量有上限,我有为了简化请求中的 geojson。
遗憾的是,没有直接的方法在对静态图像的请求中引用多个图层 API。
作为解决方法,您可以在 Mapbox Studio 中创建一个新的样式图层,该图层组合了您要对其应用过滤器的所有图层。然后你可以使用 setfilter on that layer to achieve filtering across these multiple layers, see the documentation here.
我正在使用mapbox static images API。我的风格有两层,我试图根据请求进行过滤。文档好像只提供了一个"setfilter"和一个"layer_id"属性,说明我只能过滤其中一层。
是否可以在静态图像中过滤两层(或三层、四层)API?我希望能够在处理这种情况的请求中用逗号分隔 layer_id and/or setfilter 参数。
他们在文档中提供的用于设置过滤器的示例请求是:
https://api.mapbox.com/styles/v1/mapbox/streets-v11/static/-91,60,2/800x600?access_token=YOUR_MAPBOX_ACCESS_TOKEN&setfilter=["==","name_en","Canada"]&layer_id=country-label
我正在寻找类似的东西:
https://api.mapbox.com/styles/v1/mapbox/streets-v11/static/-91,60,2/800x600?access_token=YOUR_MAPBOX_ACCESS_TOKEN&setfilters=["==","name_en","Canada"],["==","name","New York"]&layer_ids=country-label,state-label
FWIW,我目前的解决方法是对其中一个层使用叠加层来形成我需要过滤的 geojson 对象,但它很老套,并且对我可以添加到请求中的数量有上限,我有为了简化请求中的 geojson。
遗憾的是,没有直接的方法在对静态图像的请求中引用多个图层 API。
作为解决方法,您可以在 Mapbox Studio 中创建一个新的样式图层,该图层组合了您要对其应用过滤器的所有图层。然后你可以使用 setfilter on that layer to achieve filtering across these multiple layers, see the documentation here.