Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MapLayer model #5

Open
finnus opened this issue Jun 21, 2023 · 0 comments
Open

MapLayer model #5

finnus opened this issue Jun 21, 2023 · 0 comments

Comments

@finnus
Copy link

finnus commented Jun 21, 2023

I open this issue just for a discussion and to organize my thoughts. Any comments are welcome. This is early-stage WIP!

Main idea: Put all data for the creation of maplayers in a model to have it in the DB. IMO it would be the best to include an abstract model with the needed fields (as such, custom additional fields can easily be added).

In my first approach, I just added a model to configure choropleths (with popups), see: #3

However this is somehow unsatisfying as you still edit the config in base.py to add the base layers, which is cumbersome and means that you have now two (model and config file) for maplayers.

So the new approach would be to also replace the full layers.py and generate the output from the model.

I would suggest not to separate choropleth/popups and base layers as they are mostly the same thing.

IMO, we would need the following fields. As you will see, they are closely linked to the maplibre types:
name (Text): name the layer
slug (Slugfield): autogenerate a unique name from "name" field to use internally as reference
type (icon, cluster, cluster_count, line, fill, choropleth, label, outline)
geom_layer / source (FK self, null):
geom_layer_model / source_model: give the source model for the data (only needed if geom_layer/source is null)
colors: (ArrayField: used to give one or multiple hex colors, for color-coding like in choropleths or to color a line etc.)
color_coding_data (data field that colors the map, e.g. for choropleths)
icon (ImageField)
popup_fields (null, blank)
popup_title (null, blank)
popup_description (null, blank)
paint_overwrite: paint properties can be manually set here. otherwise, a default will be used. this should provide flexibility for non-standard use-cases (e.g. painting lines in different colors when having different values)
layout_overwrite: layout (text) properties can be manually set here. otherwise, a default will be used
display_order (SmallInt): to order displaying order of the layers (can be of importance when you want to show icons above an not below a choropleth map)

Of course, if needed, more fields can be added. Eg. (used for displaying the control buttons in the frontend to toggle a layer):
description, category, sub_category, fe_display_order, scenario, ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant