From 23289979b0a83b95dc49f771e4b2fb37670e3b54 Mon Sep 17 00:00:00 2001 From: "Jason T. Brown" Date: Thu, 19 Sep 2019 15:11:44 -0400 Subject: [PATCH] Attempted fix of issue 356 windows local gdal read, allow file:/ single slash Signed-off-by: Jason T. Brown --- .../org/locationtech/rasterframes/ref/GDALRasterSource.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/main/scala/org/locationtech/rasterframes/ref/GDALRasterSource.scala b/core/src/main/scala/org/locationtech/rasterframes/ref/GDALRasterSource.scala index 481155f24..d7f933279 100644 --- a/core/src/main/scala/org/locationtech/rasterframes/ref/GDALRasterSource.scala +++ b/core/src/main/scala/org/locationtech/rasterframes/ref/GDALRasterSource.scala @@ -40,12 +40,13 @@ case class GDALRasterSource(source: URI) extends RasterSource with URIRasterSour .replace("gdal+", "") .replace("gdal:/", "") // VSIPath doesn't like single slash "file:/path..." + // Local windows path regex used in VSIPath incorrectly removes only 1 slash of scheme val tweaked = if (cleaned.matches("^file:/[^/].*")) - cleaned.replace("file:", "") + cleaned.replaceFirst("^file:/", "file://") else cleaned - VLMRasterSource(tweaked) + VLMRasterSource(cleaned) // temporary work around to use `cleaned` not `tweaked` } protected def tiffInfo = SimpleRasterInfo.cache.get(source.toASCIIString, _ => SimpleRasterInfo(gdal))