This directory contains sample datasets for demonstrating data-driven styling in Google Maps. Data-driven styling allows you to customize the appearance of map features (like points, lines, and polygons) based on the data associated with those features.
-
new_york_points.csv
: This CSV file contains data about squirrel sightings in New York City. Each row represents a sighting, with the location (latitude and longitude), date, and other details about the squirrel (e.g., color, size). This data can be used to create a map where each squirrel sighting is represented by a point, and the appearance of the point (color, icon) can be customized based on the squirrel's attributes. -
boulder_polylines.geojson
: This GeoJSON file contains data about trails in Boulder, Colorado. Each feature in the file represents a trail, and the geometry is likely a polyline (a series of connected points). The file also includes attributes like trail name, difficulty, and length. This data can be used to create a map where trails are displayed as lines, and the appearance of the lines (color, thickness, pattern) can be customized based on the trail's attributes. -
kyoto_polygons.geojson
: This GeoJSON file contains data about temples in Kyoto, Japan. Each feature in the file represents a temple, and the geometry is a polygon (an enclosed area).
Uploading Data to Google Cloud Console and Using it with Google Maps:
To use this data with data-driven styling in Google Maps, you'll need to upload it to the Google Cloud Console and create a dataset. Here's a general outline of the process:
To create a new map ID, follow the steps in Create a map ID. Make sure to set the Map type to Android.
Follow the instructions in Manage map styles to create a new style and associate it with the map ID you just created.
To include data-driven styling in your map:
- Upload the dataset on the Google Maps Platform Datasets page.
- Confirm that the dataset upload is successful (sometimes there can be issues due to an invalid structure).
To enable data-driven styling:
- Open your dataset in the Google Maps Platform Datasets page.
- Click on the Preview of the dataset.
- Associate the dataset with one of the previously created styles
BOULDER_DATASET_ID=<BOULDER_DATASET_ID>
NEW_YORK_DATASET_ID=<NEW_YORK_DATASET_ID>
KYOTO_DATASET_ID=<KYOTO_DATASET_ID>
** Important: ** the map ID set in the strings.xml file must match the maps ID associated with the style.