An extremely rough proof of concept for generating terrain bitmasks autmatically from a template png image.
Make a template file in an image editor
Run the script currently via running the scene
Observe the terrains being added with the same colors as defined in your image.