Add public GeoJSON features API and load public 3D objects on maps.
CI / test (push) Successful in 3s
CI / test (push) Successful in 3s
Expose GET /v1/features/public (optional kind filter) and update Leaflet/MapLibre demos to render all public 3D assets globally, while still merging owner collections after login. Made-with: Cursor
This commit is contained in:
@@ -260,6 +260,29 @@ func (s *PostgresStore) ListFeaturesByCollection(collectionID string) []Feature
|
||||
return result
|
||||
}
|
||||
|
||||
func (s *PostgresStore) ListFeaturesAll() []Feature {
|
||||
rows, err := s.db.Query(
|
||||
`SELECT id, collection_id, owner_key, type, geometry, properties, created_at, updated_at
|
||||
FROM features ORDER BY created_at`,
|
||||
)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
defer rows.Close()
|
||||
var result []Feature
|
||||
for rows.Next() {
|
||||
var f Feature
|
||||
var geom, props []byte
|
||||
if err := rows.Scan(&f.ID, &f.CollectionID, &f.OwnerKey, &f.Type, &geom, &props, &f.CreatedAt, &f.UpdatedAt); err != nil {
|
||||
return result
|
||||
}
|
||||
_ = json.Unmarshal(geom, &f.Geometry)
|
||||
_ = json.Unmarshal(props, &f.Properties)
|
||||
result = append(result, f)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func (s *PostgresStore) GetFeature(featureID string) (Feature, error) {
|
||||
var f Feature
|
||||
var geom, props []byte
|
||||
|
||||
Reference in New Issue
Block a user