简体   繁体   English

如何在地图框中单击时突出显示标记

[英]how to highlight markers on click in mapbox

I'm doing a mapbox project, where I have a list of projects on the right side of the screen. 我正在做一个mapbox项目,在屏幕右侧有一个项目列表。 Each time I click on the list of a project name, the map will zoom to the location of the project. 每次我单击项目名称列表时,地图都会放大到该项目的位置。

I imported the markers to mapbox and used mapID to show them on the map. 我将标记导入到mapbox中,并使用mapID在地图上显示它们。

Now I want to highlight the marker for each project that I click on. 现在,我要突出显示我单击的每个项目的标记。 The mapbox highlight examples are based on geojson or csv, but I imported the markers from mapbox editor. mapbox高亮示例基于geojson或csv,但我从mapbox编辑器导入了标记。 Can anyone show me how to do the highlight? 谁能告诉我如何做突出显示?

代码通常是相同的:请参阅L.mapbox.featureLayer文档: setGeoJSON像示例一样使用setGeoJSONloadURL而不是像L.mapbox.featureLayer('mapid')一样L.mapbox.featureLayer('mapid')初始化,将'mapid'替换为您的mapid。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM