Skip to content

Commit

Permalink
fix: top level id in geojson Feature as osm_id
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Feb 26, 2024
1 parent 1f54e23 commit fcb12c5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/backend/app/db/postgis_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ async def flatgeobuf_to_geojson(
SELECT jsonb_build_object(
'type', 'Feature',
'geometry', ST_AsGeoJSON(ST_GeometryN(fgb_data.geom, 1))::jsonb,
'id', fgb_data.osm_id,
'properties', jsonb_build_object(
'osm_id', fgb_data.osm_id,
'tags', fgb_data.tags,
Expand Down Expand Up @@ -269,7 +270,7 @@ async def split_geojson_by_task_areas(
-- Insert parsed geometries and properties into the temporary table
INSERT INTO temp_features (id, geometry, properties)
SELECT
tasks.id,
(feature->'properties'->>'osm_id')::INTEGER AS id,
ST_SetSRID(ST_GeomFromGeoJSON(feature->>'geometry'), 4326) AS geometry,
jsonb_set(
jsonb_set(
Expand Down

0 comments on commit fcb12c5

Please sign in to comment.