Skip to content

Commit 0c3be1c

Browse files
committed
Handle features with null geometry
There are a couple of Stolo layers that have features without geometry (e.g. SEP_Amphibian2025). We now skip these features instead of exploding.
1 parent 4d4316d commit 0c3be1c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/spatial_features/importers/geo_json.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ def cache_key
1212

1313
def each_record(&block)
1414
parsed_geojson.fetch('features', []).each do |record|
15+
next if record['geometry'].nil? # Skip features without geometry
16+
1517
metadata = record['properties'] || {}
1618
name = metadata.delete('name')
1719
yield OpenStruct.new(

spec/fixtures/geo.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@
7272
]
7373
]
7474
}
75+
},
76+
{
77+
"type":"Feature",
78+
"properties":{
79+
"name":"Feature C",
80+
"prop0": "value"
81+
},
82+
"geometry": null
7583
}
7684
]
7785
}

0 commit comments

Comments
 (0)