Update GeoJSON Data Source
- Last UpdatedAug 19, 2024
- 1 minute read
The generated code has an instance of GeoJsonDataSource
that visualizes data from the uploaded file. Let's modify it to visualize a custom GeoJSON object. To do this, open the index.ts
file and modify it as explained below.
First, add this import of FeatureCollection
and MapViewEventNames
to the import section of the file:
Then, add the following code to the end of the createGeoJsonDataSource
function in the index.ts
file, just before the row with return geoJsonDataSource;
:
After refreshing the page, you should see a pentagon shape covering the central area of Berlin rendered on the map:
