/// <summary> /// Loads one tile. /// </summary> public static Stream LoadTile(string path, OsmGeoType type, Tile tile, bool compressed = false) { var location = DatabaseCommon.BuildPathToTile(path, type, tile, compressed); if (!FileSystemFacade.FileSystem.Exists(location)) { return(null); } if (compressed) { return(CreateInflateStream(FileSystemFacade.FileSystem.OpenRead(location))); } return(FileSystemFacade.FileSystem.OpenRead(location)); }
/// <summary> /// Creates a tile. /// </summary> public static Stream CreateTile(string path, OsmGeoType type, Tile tile, bool compressed = false) { var location = DatabaseCommon.BuildPathToTile(path, type, tile, compressed); var fileDirectory = FileSystemFacade.FileSystem.DirectoryForFile(location); if (!FileSystemFacade.FileSystem.DirectoryExists(fileDirectory)) { FileSystemFacade.FileSystem.CreateDirectory(fileDirectory); } if (compressed) { return(CreateDeflateStream(FileSystemFacade.FileSystem.Open(location, FileMode.Create))); } return(FileSystemFacade.FileSystem.Open(location, FileMode.Create)); }