Mapbox GL county identification/population
✓ Published0🌍 Public
JJn1532
Last edited Mar 21, 2018
Created on Mar 19, 2018
A Mapbox GL map highlights individual U.S. counties on mouseover, displaying the county name and total population in a small overlay panel. The example queries vector tile sources for county polygons, uses `map.queryRenderedFeatures` to identify the hovered county, and `map.setFilter` to render all matching county polygons with a distinct purple fill. Population data is summed from the features returned by `map.querySourceFeatures` and formatted with `toLocaleString`. The interaction uses Mapbox GL's Popup API and cursor styling to signal selectable regions.
AI-generated descriptionMapbox GL county identification/population
gpl-3.0 Licensed