Summary
Refactor OcotilloUI map components to consume the new OGC API - Features endpoints from NMSampleLocations instead of the current /geospatial endpoint. This enables a single, standard API for both web (OcotilloUI) and desktop (QGIS) GIS clients.
Related Issue
Current Implementation
// pages/ocotillo/map/list.tsx
const useLayer = (thing_type: string, label: string, color: string) => {
const { data, isLoading } = useOne({
dataProviderName: 'ocotillo',
resource: 'geospatial',
id: null,
meta: {
requestConfig: {
params: {
thing_type: thing_type, // Custom param
format: 'geojson',
},
},
},
})
return { sourceProps: { type: 'geojson', data: data?.data }, ... }
}
Endpoint: GET /geospatial?thing_type=water+well&format=geojson
Proposed Implementation
const useOgcLayer = (collection: string, label: string, color: string) => {
const { data, isLoading } = useOne({
dataProviderName: 'ocotillo',
resource: `ogc/collections/${collection}/items`,
id: null,
meta: {
requestConfig: {
params: {
limit: 10000,
// bbox: mapBounds // Enable viewport-based loading
},
},
},
})
return { sourceProps: { type: 'geojson', data: data?.data }, ... }
}
// Usage
const defaultLayers = {
'water-wells': useOgcLayer('wells', 'Water Wells', '#9cd0ab'),
'springs': useOgcLayer('springs', 'Springs', '#f0c0a0'),
'ephemeral-streams': useOgcLayer('ephemeral-streams', 'Ephemeral Streams', '#f5df73'),
// ...
}
Endpoint: GET /ogc/collections/wells/items?limit=10000
Benefits
| Benefit |
Description |
| Single API |
One endpoint for both QGIS and OcotilloUI |
| Standard interface |
OGC API - Features is an open standard |
| Viewport loading |
bbox param enables load-as-you-pan |
| Pagination |
Handle large datasets without timeout |
| Less maintenance |
Deprecate custom /geospatial endpoint |
Files to Modify
src/pages/ocotillo/map/list.tsx - Main map view
src/pages/amp/locations/show.tsx - Location detail map
src/pages/amp/querybuilder/index.tsx - Query builder map
src/components/form/location/CreateEditLocation.tsx - Location form map
src/components/form/group/CreateEditGroup.tsx - Group form map
Optional Enhancement: OGC Client Library
Could use @ogcapi-js/features for standardized OGC API consumption:
import { Features } from '@ogcapi-js/features'
const ogcClient = new Features(settings.ocotillo_api_url + '/ogc')
const useOgcLayer = (collection: string) => {
const [data, setData] = useState<FeatureCollection | null>(null)
const mapBounds = useMapBounds()
useEffect(() => {
ogcClient.getFeatures(collection, {
bbox: mapBounds,
limit: 1000
}).then(fc => setData(fc))
}, [collection, mapBounds])
return { data, isLoading: !data }
}
Acceptance Criteria
Dependencies
Estimate
~1 day (after OGC API is available)
Summary
Refactor OcotilloUI map components to consume the new OGC API - Features endpoints from NMSampleLocations instead of the current
/geospatialendpoint. This enables a single, standard API for both web (OcotilloUI) and desktop (QGIS) GIS clients.Related Issue
Current Implementation
Endpoint:
GET /geospatial?thing_type=water+well&format=geojsonProposed Implementation
Endpoint:
GET /ogc/collections/wells/items?limit=10000Benefits
bboxparam enables load-as-you-pan/geospatialendpointFiles to Modify
src/pages/ocotillo/map/list.tsx- Main map viewsrc/pages/amp/locations/show.tsx- Location detail mapsrc/pages/amp/querybuilder/index.tsx- Query builder mapsrc/components/form/location/CreateEditLocation.tsx- Location form mapsrc/components/form/group/CreateEditGroup.tsx- Group form mapOptional Enhancement: OGC Client Library
Could use
@ogcapi-js/featuresfor standardized OGC API consumption:Acceptance Criteria
/ogc/collections/{type}/itemsbboxparameter/geospatialendpoint deprecated (after migration complete)Dependencies
Estimate
~1 day (after OGC API is available)