Open Frophie opened 6 years ago
@Frophie I think the issue is with how the file path is formatted rather than with the FileCOGLayerReader
. As the path you're trying to read can't be turned into a URI
scala> new URI("file://E:\Work\GeoTiff\COG\catalog\zoom_cog_layer\0_0\0.tiff")
<console>:1: error: invalid escape character
new URI("file://E:\Work\GeoTiff\COG\catalog\zoom_cog_layer\0_0\0.tiff")
^
<console>:1: error: invalid escape character
new URI("file://E:\Work\GeoTiff\COG\catalog\zoom_cog_layer\0_0\0.tiff")
^
<console>:1: error: invalid escape character
new URI("file://E:\Work\GeoTiff\COG\catalog\zoom_cog_layer\0_0\0.tiff")
^
<console>:1: error: invalid escape character
new URI("file://E:\Work\GeoTiff\COG\catalog\zoom_cog_layer\0_0\0.tiff")
^
<console>:1: error: invalid escape character
new URI("file://E:\Work\GeoTiff\COG\catalog\zoom_cog_layer\0_0\0.tiff")
^
From this StackOverflow issue, it looks like you can replace the \
s in your file path with /
s, and it should still work.
Could you try doing that and seeing if it works?
Actually my input is /
, "file://E:\Work\GeoTiff\COG\catalog\zoom_cog_layer\0_0\0.tiff" is a path after some inner transform.
Here is my code:
val reader = FileCOGLayerReader("E:/Work/GeoTiff/COG/catalog")(sc)
val layer = reader.read[SpatialKey, MultibandTile](LayerId("zoom_cog_layer", 13))
println(layer.count())
And FileLayerReader("E:/Work/GeoTiff/COG/fileCatalog")(sc)
works well with it's catalog, so I think we need to check why FileCOGLayerReader
is different.
@Frophie Ah, I see. I'm looking into the issue now. Would you be okay with testing out possible solutions? I don't have a Windows machine or virtual environment to test on.
@jbouffard Yes, of course, just tell me what to do, and I will try.
Thanks, @Frophie. I'll probably contact on Gitter later today to go over some possible solutions.
@Frophie If possible, could you please pull down this branch? https://github.com/jbouffard/geotrellis/tree/bug-fix/cogs/windows-path It's basically the current master with some added println
s for debugging.
Once you pulled it down could you then please run this in the terminal?
val reader = FileCOGLayerReader("E:/Work/GeoTiff/COG/catalog")(sc)
val layer = reader.read[SpatialKey, MultibandTile](LayerId("zoom_cog_layer", 13))
println(layer.count())
After you run the above code, could you then send me all of the output? It'll help me pinpoint where things get messed up.
@lossyrob You are right about the "\" to "/" suggestion. The path turns into "\" after File.getAbsolutePath
, so I do a replace after it:
(index: BigInt) => new File(f, Index.encode(index, maxWidth)).getAbsolutePath
.replaceAll("\\\\", "/")
Then, the reading process succeed.
Tried the COG example on Windows 10 locally, seems FileCOGLayerReader can't read on Windows.