Feat: add martin integration #649
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a proof of concept PR by request of @felixerdy
Type of Change
Implementation
This PR adds Martin tile server integration to enable serving vector tiles from PostGIS database views.
Key Changes
Martin Tile Server Setup (
docker-compose.yml)Analysis View (
drizzle/0023_create_analysis_view.sql)analysis_viewthat combines:createdAt)boxId,tags)value,unit, andsensor_idmetadataAPI Endpoint (
app/routes/api.analysis.ts)/api/analysisendpoint to query theanalysis_viewlimit,offset) with max limit of 1000boxId: Filter by specific device IDhasGeometry: Only return rows with non-null geometryhasMoreflagmarkAsReadparameter enables automatic processing workflow - when set totrue, the endpoint marks all returned measurement groups as processed in theprocessed_measurementstable and refreshes the materialized view, effectively "clearing" them from subsequent queries while preserving all data in the databaseAuto-Refresh on New Measurements (
app/routes/api.measurements.ts)Environment Configuration (
app/utils/env.server.ts)MARTIN_URLenvironment variable (defaults tohttp://localhost:3001)Documentation (
MARTIN_SETUP.md)react-map-glHow It Works
analysis_viewprovides a denormalized structure optimized for data analysis and visualizationSetup and test
Checklist
devbranchAdditional Information
MARTIN_SETUP.mdfor detailed setup and usage instructions