Data / DataF
TheData component provides a container for geospatial data in GeoJSON format. It allows you to display and style features from GeoJSON data sources. Both Data and DataF are available - they are functionally identical.
Props
Data layer options object. Can include style, controlPosition, and other settings.
Mouse Event Handlers
Fired for a click on the geometry.
Fired for a double click on the geometry.
Fired for a mousedown on the geometry.
Fired when the mouse moves over the geometry.
Fired when the mouse leaves the area of the geometry.
Fired when the mouse enters the area of the geometry.
Fired for a mouseup on the geometry.
Fired for a rightclick on the geometry.
Feature Event Handlers
Fired when a feature is added to the collection.
Fired when a feature is removed from the collection.
Fired when a feature’s property is removed.
Fired when a feature’s geometry is set.
Fired when a feature’s property is set.
Lifecycle Callbacks
Called when the Data instance has loaded. Use this callback to add features, load GeoJSON, or set styles.
Called when the component unmounts.
Example
Methods
Thegoogle.maps.Data instance (available via onLoad callback) provides methods for working with GeoJSON data:
add(feature)- Adds a feature to the collectionaddGeoJson(geoJson)- Adds GeoJSON features to the collectionloadGeoJson(url)- Loads GeoJSON from a URLremove(feature)- Removes a feature from the collectionsetStyle(style)- Sets the style for all featuresoverrideStyle(feature, style)- Overrides the style for a specific featurerevertStyle(feature)- Reverts a feature to the default styleforEach(callback)- Iterates over all features
Usage Notes
- The Data layer is useful for displaying GeoJSON data from external sources
- You can style features individually based on their properties
- Features can be interactive with click and hover handlers
- Use the
onLoadcallback to access the Data instance and load your GeoJSON data