Replies: 7 comments 22 replies
-
Schemas should be driven by config (yaml/json) files. A similar example in the wild today looks like: https://docs.mapbox.com/mapbox-tiling-service/reference/ |
Beta Was this translation helpful? Give feedback.
-
Schemas should be driven by a scripting language (i.e. lua) A similar example in the wild today looks like: https://github.com/systemed/tilemaker/blob/master/resources/process-openmaptiles.lua |
Beta Was this translation helpful? Give feedback.
-
Defining schemas in Java is fine (for speed and ide support) |
Beta Was this translation helpful? Give feedback.
-
General discussion. Please post anything not specific to any of the above as a reply to this topic, unless you want to propose another big topic. |
Beta Was this translation helpful? Give feedback.
-
After some thinking, I would like to propose an in-between approach. Declarative configurations are much easier for users and simpler to implement. Scripting is something most users want once they hit declarative limitations. So, let's have it both ways (kinda):
Performance-wise this will be negligible -- the // default example - all planetiler runs must use a file like this to process data
getConfig() {
return {
layers: [
{
name: "water",
// no idea how to configure layers yet
// it will contain fields and their tag mappings, data sources, etc
}
]
};
} Complex example is similar, only this time users could add extra functions and lambda expressions: // Simple case of this could still be declarative for performance reasons, TBD
getPoiClass(tags) {
if (tags.subclass === 'station' && tags.mapping_key === 'aerialway') return 'aerialway';
...
}
getConfig() {
...
layers: [
{
name: 'poi',
fields: [
name: 'class',
dynamic: getPoiClass, // a reference to the function above
]
...
} |
Beta Was this translation helpful? Give feedback.
-
Notes from today's @openmaptiles meeting with @msbarry @nyurik @ZeLonewolf and others: A hybrid of YAML config + Java/Rust/JavaScript code which is layer specific may be the right answer here - allowing the official OpenMapTiles compatibility. Currently planetiler is already generating the code from some of the YAML files from OMT. A very basic use-case if you want to just generate vector tiles from a shapefile can be done only with a single YAML - with a code similar to https://github.com/klokantech/vector-tiles-sample/blob/master/countries.tm2source/data.yml More complex schema can be done with preprocessor - as OMT is done with "generate-*" commands. On OpenMapTiles it would mean port the code from SQL to JAVA or another picked language - and the layer structure could be preserved with additional benefits and maintainability. Example: https://github.com/openmaptiles/openmaptiles/tree/master/layers/aeroway |
Beta Was this translation helpful? Give feedback.
-
Tangentially related to planetiler - I've made a quick experiment for tileset definitions in the Starlark language, the benefit being that it's a constrained subset of Python that should be familiar to developers. The definition file would look something like this: https://github.com/bdon/protomaps-experiments/blob/master/cartographic-scripting/tileset_definition.star I've also attempted an exhaustive list of existing textual formats that attempt this task, both declarative and imperative - GL expressions, JSON, YAML, and more: https://github.com/bdon/protomaps-experiments/tree/master/cartographic-scripting#other-designs |
Beta Was this translation helpful? Give feedback.
-
Currently you need to change Java code and recompile the tool to make change the map schema that controls how input source features map to output vector tile features. How should these custom profiles be defined going forward?
Please upvote your preference, reply to an answer to discuss in more detail, or add another suggested answer for different ideas.
Thank you! 🙏
Beta Was this translation helpful? Give feedback.
All reactions