planetiler-openmaptiles
planetiler-openmaptiles copied to clipboard
Reading water\mapping.yaml always fails on code regeneration
It's especially weird since the file actually exists when you navigate manually:
https://raw.githubusercontent.com/openmaptiles/openmaptiles/v3.14/layers/water/mapping.yaml
It always fails on water/mapping.yaml
, tried 5+ times.
Command: ./scripts/regenerate-openmaptiles.sh v3.14
OS: Windows 10
Java version: openjdk 17.0.8.1
Observe following: .../v3.14/layers\water\...
, e.g. the switch from slash to back-slash. Back-slash is a Windows thing and should not be used in URL. First guess, that this might be the problematic code:
https://github.com/openmaptiles/planetiler-openmaptiles/blob/main/src/main/java/org/openmaptiles/Generate.java#L155
But I'm not able to test that since I'm on Linux. Are you able to troubleshoot that yourself?
Ah, how did I miss that?! What the heck, it's already my third day with Java, I'll give it a try.
@phanecak-maptiler
Since my Java API knowledge is limited and I don't know if there's a built-in method to do this (I did try to find out), is the way of knucklehead okay? Open to suggestions.
This fixes it:
// outside the loops
Boolean backwardSlashes = File.separatorChar == '\\';
// inside the loop (this is the problematic line)
String mappingPath = Path.of(layerFile).resolveSibling(datasource.mapping_file).normalize().toString();
if (backwardSlashes) {
mappingPath = mappingPath.replace('\\', '/');
}