Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions mapbuilder/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from .handlers.plaintext import PlainTextHandler
from .utils.geojson import load_geojson
from .utils.geopackage import load_geopackage
from .utils.json import load_json

SUFFIXES = [".txt", ".jinja"]

Expand Down Expand Up @@ -82,6 +83,11 @@ def __init__(self, source_dir, target_dir, cache_dir, config):
src = self.__load(data_source, config["data"][data_source]["source"])
if src is not None:
self.data[data_source] = load_geojson(src)
elif data_source_type == "json":
logging.debug(f"Loading JSON source {data_source}...")
self.data[data_source] = load_json(
source_dir / config["data"][data_source]["source"]
)
else:
logging.error(f"Unknown data source type for data source {data_source}")

Expand Down
6 changes: 6 additions & 0 deletions mapbuilder/utils/json.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from json import load


def load_json(filename):
with open(filename, "r") as f:
return load(f)