We then create the map of Italy via a VectorTileDataSource that only serves one GeoJson.
This is performed via a custom class, GeoJsonDataProvider. When the datasource is linked we
then set its [[StyleSet]] and add the click listener on the canvas to handle the quiz logic.
The quiz logic is performed when a region is picked. The name of the picked
region is compared to the expected name, and if they match, an update to the
VectorTileDataSource's [[StyleSet]] is performed.
The custom styling of the map given a feature property, like name in this example, is achieved
in the when expression of a Style.
In this example showcases how to use the styling of a VectorTileDataSource that using a GeoJsonDataProvider with a dynamic [[StyleSet]] to generate a quiz game. First, we generate a MapView, without MapControls this time, and then we also attach an additional base map from an VectorTileDataSource.
We then create the map of Italy via a VectorTileDataSource that only serves one GeoJson. This is performed via a custom class,
GeoJsonDataProvider
. When the datasource is linked we then set its [[StyleSet]] and add the click listener on the canvas to handle the quiz logic.The quiz logic is performed when a region is picked. The name of the picked region is compared to the expected name, and if they match, an update to the VectorTileDataSource's [[StyleSet]] is performed.
The custom styling of the map given a feature property, like
name
in this example, is achieved in thewhen
expression of a Style.