Archived
1
0

Split into Datastructure, Added ByteConverter, Full Split & Load

This commit is contained in:
2023-02-03 21:13:51 +01:00
parent f31b1b577b
commit 311afcc02f
14 changed files with 332 additions and 187 deletions

@ -1,16 +1,31 @@
using OSMImporter;
using OSMDatastructure;
namespace Server;
public class Server
{
public static Region LoadRegion(string folderPath, Coordinates coordinates)
{
string fullPath = Path.Combine(folderPath, coordinates.GetRegionHash(Importer.regionSize).ToString());
Console.WriteLine(fullPath);
Region retRegion = new Region(coordinates, Importer.regionSize);
if (!File.Exists(fullPath))
return retRegion;
FileStream fileStream = new FileStream(fullPath, FileMode.Open);
byte[] regionBytes = new byte[fileStream.Length];
fileStream.Read(regionBytes, 0, regionBytes.Length);
fileStream.Close();
return ByteConverter.ToRegion(regionBytes);
}
public static void Main(string[] args)
{
Importer.Split("/home/glax/Downloads/bayern-latest.osm", "/home/glax/Downloads/bayern-latest");
Region r = Importer.ImportRegion("/home/glax/Downloads/bayern-latest", new Coordinates(47.890f,12.56f));
foreach(KeyValuePair<ulong, Node> nodes in r.GetNodes())
Console.WriteLine(nodes.Key);
Region r = LoadRegion("/home/glax/Downloads/bayern-latest", new Coordinates(47.890f,12.56f));
}
}

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\OSMImporter\OSMImporter.csproj" />
<ProjectReference Include="..\OSMSplitter\OSMSplitter.csproj" />
</ItemGroup>
</Project>