Overview
Mas Agua’s mapping feature provides geographic visualization of water infrastructure using MapLibre GL JS. Display real-time sensor data, pump stations, and tank locations on interactive maps with customizable markers and popups.
Key Features
- MapLibre GL: Open-source map rendering with vector tiles
- Real-time Data: 15-second refresh interval for marker values
- Interactive Markers: Draggable pins with custom labels
- Popup Information: Live data display in map popups
- Navigation Controls: Zoom, pan, rotate, and tilt
- Geolocation: User location tracking
- Fullscreen Mode: Expand map to full screen
Map Components
MapBase Component
Core map rendering component with configurable controls:Props Reference
| Prop | Type | Default | Description |
|---|---|---|---|
navigationcontrol | boolean | true | Show zoom/rotate controls |
height | string | ’100%‘ | Map container height |
width | string | ’100%‘ | Map container width |
fullScreen | boolean | true | Show fullscreen button |
geolocation | boolean | true | Show locate user button |
controlPanel | boolean | true | Show marker control panel |
markers | array | [] | Array of marker objects |
setMarkers | function | - | Update markers state |
viewState | object | - | Map viewport state |
setViewState | function | - | Update viewport state |
draggable | boolean | false | Allow marker dragging |
withInfo | boolean | false | Fetch and display real-time data |
Map Configuration
View State
Defines the map’s viewport:Map Style
Using MapTiler vector tiles:Markers
Marker Structure
Adding Markers
Markers are added through a form interface:Generating Markers
Real-time Data Updates
Automatic Refresh
Markers update their values every 15 seconds whenwithInfo={true}:
Fetching Marker Data
Variable Extraction
Popups
Popup Display
Popups show marker name and real-time value:Status Field Formatting
Boolean status fields are interpreted as on/off:Pin Component
Custom pin marker with label:Draggable Markers
Whendraggable={true}, markers can be repositioned:
Map Controls
Navigation Control
Zoom and rotation buttons:Fullscreen Control
Expand map to fullscreen:Geolocation Control
Locate user position:Control Panel
Optional marker management panel whencontrolPanel={true}:
Saving Maps
Maps are saved to the backend with all configuration:Save API
Loading Maps
Load existing map configuration:Map Views
View-Only Mode
Display saved map with real-time data:Edit Mode
Edit existing map configuration:Create Mode
Create new map:Responsive Layout
Use Cases
Water Distribution Network
Map showing pressure sensors across the network:Tank Monitoring
Tank locations with level indicators:Pump Stations
Pump locations with on/off status:Best Practices
Marker Density
Marker Density
- Keep markers under 50 per map for performance
- Use clustering for dense areas (future feature)
- Split large networks into regional maps
Data Refresh
Data Refresh
- 15-second interval is optimal for real-time monitoring
- Disable real-time updates (
withInfo={false}) for static maps - Monitor network usage with many markers
Map Styling
Map Styling
- Use consistent marker colors for similar asset types
- Consider using custom icons for different infrastructure
- Keep popup information concise
Troubleshooting
Markers Not Updating
- Check
withInfo={true}is set - Verify InfluxDB variable configuration in markers
- Check browser console for API errors
- Confirm 15-second refresh interval is running
Map Not Loading
- Verify MapTiler API key is valid
- Check internet connection
- Confirm
react-map-glandmaplibre-glversions - Check browser console for WebGL errors
Dragging Issues
- Ensure
draggable={true}is set on MapBase - Check markers have unique IDs
- Verify
setMarkersfunction is provided
Next Steps
Dashboard
Display map data in dashboard charts
Diagram Editor
Create visual network diagrams

