Skip to content

Commit

Permalink
Fix jpath based nested geojson plotting
Browse files Browse the repository at this point in the history
  • Loading branch information
merschformann committed Jan 23, 2025
1 parent af67550 commit 78516ac
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions nextplot/geojson.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,15 @@ def parse(
Parses the geojson data object(s) from the file(s).
"""
# Load json data
content_geojson, _ = common.load_data(input_geojson, "")
content, _ = common.load_data(input_geojson, "")
json_content = json.loads(content)

# Extract geojsons
if jpath_geojson:
expression = jsonpath_ng.parse(jpath_geojson)
geojsons = [json.loads(match.value) for match in expression.find(content_geojson)]
geojsons = [match.value for match in expression.find(json_content)]
else:
geojsons = [json.loads(content_geojson)]
geojsons = [json_content]

return geojsons

Expand Down

0 comments on commit 78516ac

Please sign in to comment.