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

Reading water\mapping.yaml always fails on code regeneration #109

Open
adjourn opened this issue Sep 16, 2023 · 3 comments
Open

Reading water\mapping.yaml always fails on code regeneration #109

adjourn opened this issue Sep 16, 2023 · 3 comments

Comments

@adjourn
Copy link

adjourn commented Sep 16, 2023

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.

screenshot

Command: ./scripts/regenerate-openmaptiles.sh v3.14
OS: Windows 10
Java version: openjdk 17.0.8.1

@phanecak-maptiler
Copy link
Collaborator

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?

@adjourn
Copy link
Author

adjourn commented Sep 18, 2023

Ah, how did I miss that?!
What the heck, it's already my third day with Java, I'll give it a try.

@adjourn
Copy link
Author

adjourn commented Sep 18, 2023

@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('\\', '/');
}

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

2 participants