EventMapTile Documentation
Overview
The EventMapTile component is designed to provide an interactive map interface that visualizes event data based on geographical locations. It integrates with a backend service (e.g., GDELT) to fetch event data that can be displayed as clusters on a map. Users can search for events by location or topic, and the map is capable of displaying different styles and configurations through customizable settings. The EventMapTile is particularly useful for businesses or applications focused on event tracking, geographical analytics, or real-time incident reporting.
Settings
The EventMapTile component accepts a variety of settings that determine its appearance and behavior. Below is a detailed breakdown of each setting:
-
mapStyle
- Input Type: Dropdown (String)
- Description: This setting defines the visual style of the map. Changing this value alters the aesthetics of the map (e.g., light, dark, or standard views).
- Default Value:
osm(OpenStreetMap style). - Effect of Change: Switching to different styles (e.g.,
dark,voyager) affects the color scheme and overall visual feel of the map.
-
markerColor
- Input Type: String (Hexadecimal color)
- Description: Specifies the color of the markers used to represent events on the map.
- Default Value:
#ef4444(a shade of red). - Effect of Change: Changing this value modifies the color of both clustered and unclustered event markers, allowing for customized accent colors.
-
defaultQuery
- Input Type: String
- Description: Defines the default search term displayed in the search input when the map loads.
- Default Value:
''(empty string). - Effect of Change: Setting a default query allows users to view pre-defined events for a specific location or topic immediately upon loading the map.
-
defaultTimespan
- Input Type: Dropdown (String)
- Description: Pre-defines the period over which to search for events.
- Default Value:
'1d'(24 hours). - Effect of Change: Changing this value adjusts the historical range of events displayed on the map (e.g., 15 minutes, 1 hour, 1 day, etc.).
Functionality
The EventMapTile fetches and displays event data based on user input. It uses the lifecycle management hook to initialize the map upon component mount and the optimized callbacks hook to perform search actions efficiently. The event data is retrieved via an API call built with fetch, and it effectively handles loading states, error messages, and user interactivity with map controls.
Data Expectations
The component expects to receive the following data:
- Query: A string representing a search term for locating events (e.g., "earthquake" or "New York").
- Timespan: A string that denotes the period in which events must fall to be displayed (e.g., "1d", "7d").
- The component internally fetches GeoJSON data from the API based on these parameters.
AI Integrations
The EventMapTile does not explicitly integrate AI functionality. However, it could utilize AI-powered analytics for understanding event trends or improve search relevancy by analyzing historical data patterns.
Billing Impacts
Using the EventMapTile may incur API usage costs, particularly if the backend event data source operates on a pay-per-call basis (like GDELT or similar services). Users should monitor their API usage to avoid unexpected costs.
Use Cases & Examples
Use Cases
- Disaster Management: Organizations can utilize the EventMapTile to visualize and monitor natural disasters such as earthquakes, floods, or hurricanes in real-time.
- Social Media Analytics: Businesses can track events related to social trends by visualizing mentions or topics from social media platforms, improving marketing strategies.
- Traffic Monitoring: Transportation agencies can display traffic incidents and road conditions, helping to inform the public about live traffic situations.
Example Configuration
Use Case: Disaster Management - Visualizing earthquake events.
Sample Configuration Data:
{
"tile": {
"config": {
"mapStyle": "osm",
"markerColor": "#ff0000",
"defaultQuery": "earthquake",
"defaultTimespan": "7d"
}
}
}In this example configuration:
- The map will have the OpenStreetMap style.
- Markers representing earthquakes will appear in red.
- A default search term of "earthquake" is provided.
- The timespan for the events will be set to retrieve data from the past 7 days.
In summary, the EventMapTile is a powerful, flexible component designed for developers and organizations looking to leverage geographic event data in real time, enhancing user engagement and actionable insights.