3.6 KiB
3.6 KiB
NocoDB Map Viewer
A containerized web application that visualizes geographic data from NocoDB on an interactive map using Leaflet.js.
Features
- 🗺️ Interactive map visualization with OpenStreetMap
- 📍 Real-time geolocation support
- ➕ Add new locations directly from the map
- 🔄 Auto-refresh every 30 seconds
- 📱 Responsive design for mobile devices
- 🔒 Secure API proxy to protect credentials
- 🐳 Docker containerization for easy deployment
- 🆓 100% open source (no proprietary dependencies)
Quick Start
Prerequisites
- Docker and Docker Compose
- NocoDB instance with a table containing location data
- NocoDB API token
NocoDB Table Setup
-
Create a table in NocoDB with these required columns:
geodata(Text): Format "latitude;longitude"latitude(Decimal): Precision 10, Scale 8longitude(Decimal): Precision 11, Scale 8
-
Optional recommended columns:
title(Text): Location namedescription(Long Text): Detailscategory(Single Select): Classification
Installation
-
Clone this repository or create the file structure as shown
-
Copy the environment template:
cp .env.example .env -
Edit
.envwith your NocoDB details:NOCODB_API_URL=https://db.lindalindsay.org/api/v1 NOCODB_API_TOKEN=your-token-here NOCODB_VIEW_URL=https://db.lindalindsay.org/dashboard/#/nc/p406kno3lbq4zmq/mvtryxrvze6td79 -
Start the application:
docker-compose up -d -
Access the map at: http://localhost:3000
Finding NocoDB IDs
API Token
- Click user icon → Account Settings
- Go to "API Tokens" tab
- Create new token with read/write permissions
Project and Table IDs
- Simply provide the full NocoDB view URL in
NOCODB_VIEW_URL - The system will automatically extract the project and table IDs
API Endpoints
GET /api/locations- Fetch all locationsPOST /api/locations- Create new locationGET /api/locations/:id- Get single locationPUT /api/locations/:id- Update locationDELETE /api/locations/:id- Delete locationGET /health- Health check
Configuration
All configuration is done via environment variables:
| Variable | Description | Default |
|---|---|---|
NOCODB_API_URL |
NocoDB API base URL | Required |
NOCODB_API_TOKEN |
API authentication token | Required |
NOCODB_VIEW_URL |
Full NocoDB view URL | Required |
PORT |
Server port | 3000 |
DEFAULT_LAT |
Default map latitude | 53.5461 |
DEFAULT_LNG |
Default map longitude | -113.4938 |
DEFAULT_ZOOM |
Default map zoom level | 11 |
Development
To run in development mode:
-
Install dependencies:
cd app npm install -
Start with hot reload:
npm run dev
Security Considerations
- API tokens are kept server-side only
- CORS is configured for security
- Rate limiting prevents abuse
- Input validation on all endpoints
- Helmet.js for security headers
Troubleshooting
Locations not showing
- Verify table has
geodata,latitude, andlongitudecolumns - Check that coordinates are valid numbers
- Ensure API token has read permissions
Cannot add locations
- Verify API token has write permissions
- Check browser console for errors
- Ensure coordinates are within valid ranges
Connection errors
- Verify NocoDB instance is accessible
- Check API URL format
- Confirm network connectivity
License
MIT License - See LICENSE file for details
Support
For issues or questions:
- Check the troubleshooting section
- Review NocoDB documentation
- Open an issue on GitHub