Skip to content

Commit

Permalink
Add ability to create custom layers
Browse files Browse the repository at this point in the history
  • Loading branch information
russss committed May 4, 2024
1 parent 0ad959f commit 0b01b82
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion buildmap/exporter/tegola.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def generate_tegola_config(self):
}

if (
type(self.config["mapbox_vector_layer"]) is dict
isinstance(self.config["mapbox_vector_layer"], dict)
and "attribution" in self.config["mapbox_vector_layer"]
):
m["attribution"] = self.config["mapbox_vector_layer"]["attribution"]
Expand Down Expand Up @@ -150,6 +150,22 @@ def generate_tegola_config(self):
}
)

for layer_name, data in self.config.get("custom_layers", {}).items():
provider["layers"].append(
{
"name": layer_name,
"sql": data["query"],
"geometry_type": data["geometry_type"],
}
)
m["layers"].append(
{
"provider_layer": "%s.%s" % (self.PROVIDER_NAME, layer_name),
"min_zoom": self.config["zoom_range"][0],
"max_zoom": self.config["zoom_range"][1],
}
)

# Construct config
data = {
"cache": {"type": "file", "basepath": "/tmp/tegola"},
Expand Down

0 comments on commit 0b01b82

Please sign in to comment.