Skip to content

Instantly share code, notes, and snippets.

@jknair0
Last active September 19, 2019 10:06
Show Gist options
  • Select an option

  • Save jknair0/eddcff3170dae8c61e025335c9a68504 to your computer and use it in GitHub Desktop.

Select an option

Save jknair0/eddcff3170dae8c61e025335c9a68504 to your computer and use it in GitHub Desktop.
highlight a feature in mapbox android
private fun updateScannedFeatures(scannedCodeStatus: List<ScannedCodeStatus>) {
val loadedStyle = mapBoxMap?.style ?: return
val mainSolarTablesLayer = loadedStyle.getLayer(MAIN_SOLAR_TABLES_LAYER_ID) as? FillLayer ?: return
val uidLiteralsArray = scannedCodeStatus.map { it.featureUid }
val stops = uidLiteralsArray.map { Expression.stop(it, Expression.color(Color.RED)) }
mainSolarTablesLayer.setProperties(
PropertyFactory.fillColor(
Expression.match(Expression.get("uid"),
Expression.color(Color.BLACK),
* stops.toTypedArray()
)
)
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment