private void CreateOfflinePoisFile(List <Feature> features) { var collection = new FeatureCollection(); foreach (var feature in features) { collection.Add(feature); } var outputMemStream = new MemoryStream(); using (var zipStream = new ZipOutputStream(outputMemStream)) { zipStream.SetLevel(9); var newEntry = new ZipEntry("pois/pois.geojson") { DateTime = DateTime.Now }; zipStream.PutNextEntry(newEntry); StreamUtils.Copy(new MemoryStream(collection.ToBytes()), zipStream, new byte[4096]); zipStream.CloseEntry(); CreateImagesJsonFiles(features, zipStream); zipStream.Finish(); outputMemStream.Position = 0; _fileSystemHelper.WriteAllBytes("pois.ihm", outputMemStream.ToArray()); } }
private void CreateGeoJsonFile(List <Feature> features) { var collection = new FeatureCollection(); foreach (var feature in features) { collection.Add(feature); } _fileSystemHelper.WriteAllBytes("pois.geojson", collection.ToBytes()); }
private async Task DownloadDailyOsmFile(string workingDirectory) { var response = await _remoteFileFetcherGateway.GetFileContent(OSM_FILE_ADDRESS); _fileSystemHelper.WriteAllBytes(Path.Combine(workingDirectory, Sources.OSM_FILE_NAME), response.Content); // Update timestamp to match the one from the server. var file = await _remoteFileFetcherGateway.GetFileContent(OSM_FILE_TIMESTAMP); var stringContent = Encoding.UTF8.GetString(file.Content); var lastLine = stringContent.Split('\n').Last(s => !string.IsNullOrWhiteSpace(s)); var timeStamp = lastLine.Split('=').Last().Replace("\\", ""); RunOsmConvert($"--timestamp={timeStamp} {Sources.OSM_FILE_NAME}", workingDirectory); }