mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 12:46:30 +00:00
add gps matcher service
This commit is contained in:
@@ -67,7 +67,9 @@ public class ConfigUpdater : IConfigUpdater
|
||||
ImagesDirectory = Constants.DEFAULT_IMAGES_DIR,
|
||||
LabelsDirectory = Constants.DEFAULT_LABELS_DIR,
|
||||
ResultsDirectory = Constants.DEFAULT_RESULTS_DIR,
|
||||
ThumbnailsDirectory = Constants.DEFAULT_THUMBNAILS_DIR
|
||||
ThumbnailsDirectory = Constants.DEFAULT_THUMBNAILS_DIR,
|
||||
GpsSatDirectory = Constants.DEFAULT_GPS_SAT_DIRECTORY,
|
||||
GpsRouteDirectory = Constants.DEFAULT_GPS_ROUTE_DIRECTORY
|
||||
},
|
||||
|
||||
ThumbnailConfig = new ThumbnailConfig
|
||||
|
||||
@@ -7,4 +7,7 @@ public class DirectoriesConfig
|
||||
public string ImagesDirectory { get; set; } = null!;
|
||||
public string ResultsDirectory { get; set; } = null!;
|
||||
public string ThumbnailsDirectory { get; set; } = null!;
|
||||
|
||||
public string GpsSatDirectory { get; set; } = null!;
|
||||
public string GpsRouteDirectory { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace Azaion.Common.DTO;
|
||||
|
||||
public class DownloadTilesResult
|
||||
{
|
||||
public ConcurrentDictionary<(int x, int y), byte[]> Tiles { get; set; } = null!;
|
||||
public double LatMin { get; set; }
|
||||
public double LatMax { get; set; }
|
||||
public double LonMin { get; set; }
|
||||
public double LonMax { get; set; }
|
||||
}
|
||||
@@ -2,24 +2,25 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
public class GpsCsvResult
|
||||
public class GpsMatchResult
|
||||
{
|
||||
public string Image { get; set; }
|
||||
public double Latitude { get; set; }
|
||||
public int Index { get; set; }
|
||||
public string Image { get; set; }
|
||||
public double Latitude { get; set; }
|
||||
public double Longitude { get; set; }
|
||||
public int Keypoints { get; set; }
|
||||
public int Rotation { get; set; }
|
||||
public string MatchType { get; set; }
|
||||
|
||||
public static List<GpsCsvResult> ReadFromCsv(string csvFilePath)
|
||||
public static List<GpsMatchResult> ReadFromCsv(string csvFilePath)
|
||||
{
|
||||
var imageDatas = new List<GpsCsvResult>();
|
||||
var imageDatas = new List<GpsMatchResult>();
|
||||
|
||||
using var reader = new StreamReader(csvFilePath);
|
||||
//read header
|
||||
reader.ReadLine();
|
||||
if (reader.EndOfStream)
|
||||
return new List<GpsCsvResult>();
|
||||
return new List<GpsMatchResult>();
|
||||
|
||||
while (!reader.EndOfStream)
|
||||
{
|
||||
@@ -29,7 +30,7 @@ public class GpsCsvResult
|
||||
var values = line.Split(',');
|
||||
if (values.Length == 6)
|
||||
{
|
||||
imageDatas.Add(new GpsCsvResult
|
||||
imageDatas.Add(new GpsMatchResult
|
||||
{
|
||||
Image = GetFilename(values[0]),
|
||||
Latitude = double.Parse(values[1]),
|
||||
@@ -0,0 +1,31 @@
|
||||
using Azaion.Common.Extensions;
|
||||
|
||||
namespace Azaion.Common.DTO;
|
||||
|
||||
public class SatTile
|
||||
{
|
||||
public int X { get; }
|
||||
public int Y { get; }
|
||||
public double LeftTopLat { get; }
|
||||
public double LeftTopLon { get; }
|
||||
|
||||
public double BottomRightLat { get; }
|
||||
public double BottomRightLon { get; }
|
||||
public string Url { get; set; }
|
||||
|
||||
|
||||
public SatTile(int x, int y, int zoom, string url)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Url = url;
|
||||
|
||||
(LeftTopLat, LeftTopLon) = GeoUtils.TileToWorldPos(x, y, zoom);
|
||||
(BottomRightLat, BottomRightLon) = GeoUtils.TileToWorldPos(x + 1, y + 1, zoom);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Tile[X={X}, Y={Y}, TL=({LeftTopLat:F6}, {LeftTopLon:F6}), BR=({BottomRightLat:F6}, {BottomRightLon:F6})]";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user