-
Notifications
You must be signed in to change notification settings - Fork 137
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
Add support for extendable layer schema #377
Comments
The requirements from the tools would be derived from the new structure of defining a layer. The structure could be based on the following principals. The transition of the layers to the new structure can be done on a layer-by-layer basis, once the tool support is available.
The following tool-related enhancements could help implementing the above:
|
A further improvement over the direct use of a It would roughly be:
Where To be discussed: Should such SQL-generated fields be stored as separate columns, as entries in the Note: The |
One of the challenges I see is that there is a fundamental limit of imposm mappings - you can only specify a single Now, in general, the information domain helps us here. If we add Given this limitation of imposm, we would need to introduce a computed column (probably in a separate table, accessed via This would allow us to build arbitrary |
We should have the ability in
|
It seems to be more than that. The For example, the An |
Hmm. So you want to map them as regular columns, pack them into an hstore, and then explode the hstore in the layer function? We could make that work. |
Yes! |
My only concern with this approach is that once the new syntax is available in @nyurik, @ZeLonewolf, |
I suppose that work just needs to get done, one layer at a time. |
@zstadler we don't need to migrate anything at first -- only the layers that we want to support such functionality will implement it, and others should raise an error if a user tries to extend them. |
|
One issue I've discovered is that tags that are injected into the tags hstore don't get imposm's type processing. If you have something mapped as a |
Okay, actually this is not a problem at all thanks to postgres's typing: So |
* implements openmaptiles/openmaptiles#1345 * partially implements #377 ### Layer file changes * Added support for an optional `min_buffer_size` value, which is only used in case of a global override, but if set, it must be less than or equal to `buffer_size`. * Layer's `buffer_size` is now optional if `min_buffer_size` is set. ```yaml layer: id: housenumber # Only one of these is mandatory min_buffer_size: 1 buffer_size: 8 ``` ### Tileset file changes * Added support for an optional `overrides` section (similar to `defaults`). * Only supports optional `overrides.buffer_size` int value for now. If set, this value will override the `buffer_size` set in the layer. If layer has `min_buffer_size`, the largest of the two will be used. * Added support for per layer overrides as described in #377. Only supports `buffer_size` and `min_buffer_size` * An environment variable `TILE_BUFFER_SIZE` can be used instead of `overrides.buffer_size`, and it takes precedence. This example will load two layers. Mountain peak will be used as is, and house numbers's min buffer zoom is modified. The global override=0 will set mountain peaks buffer to 0 (because it has no min_buffer_size defined inside the layer file), but the house number buffer size will be 5. ```yaml tileset: layers: - mountain_peak/mountain_peak.yaml - file: housenumber/housenumber.yaml min_buffer_size: 5 overrides: buffer_size: 0 ``` ### Breaking * Remove deprecated tileset and layer properties (they have been deprecated for many years, and are not used)
* implements openmaptiles/openmaptiles#1345 * partially implements openmaptiles#377 ### Layer file changes * Added support for an optional `min_buffer_size` value, which is only used in case of a global override, but if set, it must be less than or equal to `buffer_size`. * Layer's `buffer_size` is now optional if `min_buffer_size` is set. ```yaml layer: id: housenumber # Only one of these is mandatory min_buffer_size: 1 buffer_size: 8 ``` ### Tileset file changes * Added support for an optional `overrides` section (similar to `defaults`). * Only supports optional `overrides.buffer_size` int value for now. If set, this value will override the `buffer_size` set in the layer. If layer has `min_buffer_size`, the largest of the two will be used. * Added support for per layer overrides as described in openmaptiles#377. Only supports `buffer_size` and `min_buffer_size` * An environment variable `TILE_BUFFER_SIZE` can be used instead of `overrides.buffer_size`, and it takes precedence. This example will load two layers. Mountain peak will be used as is, and house numbers's min buffer zoom is modified. The global override=0 will set mountain peaks buffer to 0 (because it has no min_buffer_size defined inside the layer file), but the house number buffer size will be 5. ```yaml tileset: layers: - mountain_peak/mountain_peak.yaml - file: housenumber/housenumber.yaml min_buffer_size: 5 overrides: buffer_size: 0 ``` ### Breaking * Remove deprecated tileset and layer properties (they have been deprecated for many years, and are not used)
As discussed in openmaptiles/openmaptiles#1252, we need a way for users to extend which fields to include with a layer without modifying the actual code. Instead, users will modify the main yaml file (i.e.
openmaptiles.yaml
) to specify needed changes.The above would only work for layers that expose
tags
HSTORE field at the top SQL layer, and have a magic keyword as part of its SQL statement. Resulting layer modifications:Please update the following sections with the exact specification, or add comments with proposals:
Imposm mapping file
TODO: what changes should tools do to the mapping file(s), and how should tools determine which file/table/key should be modified
Add field declarations
Layer specification is updated dynamically: new fields with their descriptions are added to the
layer.fields
map.TODO: decide if we should support
values
param, and if so, how.TODO: decide if we want to support updates to existing fields, for example adding more enum values to
class
. Is this needed at all? E.g. if we add a value to transportation class, it will not be straightforward to change which of them are included in z12Update main SQL statement
TODO: We currently use
%%FIELD_MAPPING: class %%
for SQL modifications. We could use something similar here, e.g. introduce a new%%CUSTOM_TAGS%%
? Replacement might be in the formNULLIF(tags->'maxspeed', '') AS "maxspeed",
, or we may want to allow users to provide their own SQL.The text was updated successfully, but these errors were encountered: