Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3224b82
Remove a warning
charlenni Mar 29, 2025
bc13279
Add a DataSource for a MBTiles SQLite file
charlenni Mar 29, 2025
9c960a3
Add tests for new MBTiles file data source
charlenni Mar 29, 2025
c73d169
Remove old tile source
charlenni Mar 29, 2025
698eb1b
Add a Mapbox tile reader for converting DataSource to VectorTile
charlenni Mar 29, 2025
22935bd
Add tests for new Mapbox tile reader
charlenni Mar 29, 2025
8a24f99
Downgrade to BruTile 5.0.6
charlenni Mar 29, 2025
86e9d30
Add some packages
charlenni Mar 29, 2025
9a2bc92
Add some projects
charlenni Mar 29, 2025
3d7656c
Add a data source for map tiles in a folder structure. If I find some…
charlenni Mar 29, 2025
a1f3945
Add benchmarking
charlenni Mar 30, 2025
b9dc9fd
Add data to reader, so that benchmarks test only reader and not data …
charlenni Mar 30, 2025
df60557
Add overload for constructor, so that no connection string has to be …
charlenni Mar 30, 2025
fdb5cee
Make tests and benchmarks easier
charlenni Mar 30, 2025
bbb00e9
Remove a bug, where MBTiles path isn't correct for benchmarks
charlenni Mar 30, 2025
355e7ac
Add some more benchmarks
charlenni Mar 30, 2025
9015311
Change name of reader
charlenni Mar 30, 2025
f6e31c2
Divide projects for data sources in different projects
charlenni Mar 30, 2025
83df10d
Remove a bug where benchmark wasn't compile
charlenni Mar 30, 2025
af96fb0
Add support for dotnetstandard2.0 and .net8.0
charlenni Mar 31, 2025
056134e
Change for dotnetstandard2.0 compatibility
charlenni Mar 31, 2025
a350ec5
Change naming of readers to converters for more clearance what this p…
charlenni Mar 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@
<CentralPackageTransitivePinningEnabled>false</CentralPackageTransitivePinningEnabled>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
<PackageVersion Include="BruTile" Version="5.0.6" />
<PackageVersion Include="BruTile.MbTiles" Version="5.0.6" />
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
<PackageVersion Include="Mapsui" Version="5.0.0-beta.11" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="NetTopologySuite.IO.VectorTiles" Version="1.1.0" />
<PackageVersion Include="NetTopologySuite.IO.VectorTiles.Mapbox" Version="1.1.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="NLog" Version="5.0.0" />
<PackageVersion Include="protobuf-net" Version="3.2.46" />
<PackageVersion Include="SkiaSharp" Version="2.88.7" />
<PackageVersion Include="sqlite-net-pcl" Version="1.8.116" />
<PackageVersion Include="Svg" Version="3.4.7" />
Expand All @@ -23,4 +28,4 @@
<PackageVersion Include="xunit" Version="2.5.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.3" />
</ItemGroup>
</Project>
</Project>
81 changes: 70 additions & 11 deletions VexTile.Renderers.sln
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.13.35913.81
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{91E5AD39-7402-4D0A-BB0F-9B21C48283F9}"
ProjectSection(SolutionItems) = preProject
LICENSE = LICENSE
README.md = README.md
.gitignore = .gitignore
images\logo.png = images\logo.png
Directory.Packages.props = Directory.Packages.props
Directory.Build.props = Directory.Build.props
Directory.Packages.props = Directory.Packages.props
LICENSE = LICENSE
images\logo.png = images\logo.png
README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AliFlux", "AliFlux", "{524E5240-2A32-4B31-8329-A6A3CB0ADC5F}"
Expand All @@ -30,18 +33,31 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tiles", "tiles", "{7F818319
tiles\zurich.mbtiles = tiles\zurich.mbtiles
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DataSources", "DataSources", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{60740B31-4437-4B25-B266-E08E9CB793C2}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Converters", "Converters", "{3DC520CC-855B-46B8-9679-752FA2F6A9AA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VexTile.DataSources.Tests", "tests\VexTile.DataSources.Tests\VexTile.DataSources.Tests.csproj", "{A80B8953-B2DB-6562-9097-A701508C1416}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Benchmarks", "Benchmarks", "{0FC1822F-7178-4AB2-9ECA-95A023A63A46}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VexTile.VectorTileReaders.Benchmarks", "benchmarks\VexTile.VectorTileReaders.Benchmarks\VexTile.VectorTileReaders.Benchmarks.csproj", "{9AEC80A5-0B39-F2CC-8E7D-74A7B8EBA13B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VexTile.DataSource.MBTilesSQLite", "source\DataSources\VexTile.DataSource.MBTilesSQLite\VexTile.DataSource.MBTilesSQLite.csproj", "{6DF0537C-8901-26A3-F93D-A50AFD62B83E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VexTile.DataSource.MBTilesFolder", "source\DataSources\VexTile.DataSource.MBTileFolder\VexTile.DataSource.MBTilesFolder.csproj", "{47D47BCA-DA41-E462-E236-6C0A8D1C22A1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VexTile.Converter.Mapbox", "source\converters\VexTile.Converter.Mapbox\VexTile.Converter.Mapbox.csproj", "{5873DF06-BBA7-B7B0-4103-F26E96428737}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VexTile.Converters.Tests", "tests\VexTile.Converters.Tests\VexTile.Converters.Tests.csproj", "{2371704E-ABF8-9354-A4E6-438A74AD734D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{524E5240-2A32-4B31-8329-A6A3CB0ADC5F} = {E18861F9-FDA0-45AE-92FD-CA6FB4A02E36}
{B1E58241-A026-4DF9-8EC6-7613CC309591} = {524E5240-2A32-4B31-8329-A6A3CB0ADC5F}
{8581D51C-7311-41B0-A2C2-AE479F0844AF} = {524E5240-2A32-4B31-8329-A6A3CB0ADC5F}
{8F525597-1FBA-476F-8FB7-70397910C126} = {B93F42B4-7405-402D-BE86-0940BD932412}
{7F818319-AA94-4F81-B0F4-68A5D161228C} = {91E5AD39-7402-4D0A-BB0F-9B21C48283F9}
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B1E58241-A026-4DF9-8EC6-7613CC309591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B1E58241-A026-4DF9-8EC6-7613CC309591}.Debug|Any CPU.Build.0 = Debug|Any CPU
Expand All @@ -59,5 +75,48 @@ Global
{802FCE68-9F38-4140-B7B2-FE41B8866888}.Debug|Any CPU.Build.0 = Debug|Any CPU
{802FCE68-9F38-4140-B7B2-FE41B8866888}.Release|Any CPU.ActiveCfg = Release|Any CPU
{802FCE68-9F38-4140-B7B2-FE41B8866888}.Release|Any CPU.Build.0 = Release|Any CPU
{A80B8953-B2DB-6562-9097-A701508C1416}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A80B8953-B2DB-6562-9097-A701508C1416}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A80B8953-B2DB-6562-9097-A701508C1416}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A80B8953-B2DB-6562-9097-A701508C1416}.Release|Any CPU.Build.0 = Release|Any CPU
{9AEC80A5-0B39-F2CC-8E7D-74A7B8EBA13B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9AEC80A5-0B39-F2CC-8E7D-74A7B8EBA13B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9AEC80A5-0B39-F2CC-8E7D-74A7B8EBA13B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9AEC80A5-0B39-F2CC-8E7D-74A7B8EBA13B}.Release|Any CPU.Build.0 = Release|Any CPU
{6DF0537C-8901-26A3-F93D-A50AFD62B83E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6DF0537C-8901-26A3-F93D-A50AFD62B83E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6DF0537C-8901-26A3-F93D-A50AFD62B83E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6DF0537C-8901-26A3-F93D-A50AFD62B83E}.Release|Any CPU.Build.0 = Release|Any CPU
{47D47BCA-DA41-E462-E236-6C0A8D1C22A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{47D47BCA-DA41-E462-E236-6C0A8D1C22A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47D47BCA-DA41-E462-E236-6C0A8D1C22A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{47D47BCA-DA41-E462-E236-6C0A8D1C22A1}.Release|Any CPU.Build.0 = Release|Any CPU
{5873DF06-BBA7-B7B0-4103-F26E96428737}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5873DF06-BBA7-B7B0-4103-F26E96428737}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5873DF06-BBA7-B7B0-4103-F26E96428737}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5873DF06-BBA7-B7B0-4103-F26E96428737}.Release|Any CPU.Build.0 = Release|Any CPU
{2371704E-ABF8-9354-A4E6-438A74AD734D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2371704E-ABF8-9354-A4E6-438A74AD734D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2371704E-ABF8-9354-A4E6-438A74AD734D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2371704E-ABF8-9354-A4E6-438A74AD734D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{524E5240-2A32-4B31-8329-A6A3CB0ADC5F} = {E18861F9-FDA0-45AE-92FD-CA6FB4A02E36}
{B1E58241-A026-4DF9-8EC6-7613CC309591} = {524E5240-2A32-4B31-8329-A6A3CB0ADC5F}
{8581D51C-7311-41B0-A2C2-AE479F0844AF} = {524E5240-2A32-4B31-8329-A6A3CB0ADC5F}
{8F525597-1FBA-476F-8FB7-70397910C126} = {B93F42B4-7405-402D-BE86-0940BD932412}
{7F818319-AA94-4F81-B0F4-68A5D161228C} = {91E5AD39-7402-4D0A-BB0F-9B21C48283F9}
{A80B8953-B2DB-6562-9097-A701508C1416} = {60740B31-4437-4B25-B266-E08E9CB793C2}
{9AEC80A5-0B39-F2CC-8E7D-74A7B8EBA13B} = {0FC1822F-7178-4AB2-9ECA-95A023A63A46}
{6DF0537C-8901-26A3-F93D-A50AFD62B83E} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{47D47BCA-DA41-E462-E236-6C0A8D1C22A1} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{5873DF06-BBA7-B7B0-4103-F26E96428737} = {3DC520CC-855B-46B8-9679-752FA2F6A9AA}
{2371704E-ABF8-9354-A4E6-438A74AD734D} = {60740B31-4437-4B25-B266-E08E9CB793C2}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0B7E5C58-5DE8-4E43-BADC-70CFCD54D996}
EndGlobalSection
EndGlobal
52 changes: 52 additions & 0 deletions benchmarks/VexTile.VectorTileReaders.Benchmarks/Benchmarks.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using BenchmarkDotNet.Attributes;
using NetTopologySuite.IO.VectorTiles.Tiles;
using VexTile.Common.Sources;
using VexTile.DataSource.MBTilesSQLite;
using VexTile.Converter.Mapbox;

namespace VexTile.VectorTileReaders.Benchmarks
{
[MemoryDiagnoser]
public class Benchmarks
{
readonly string _path = "..\\..\\..\\..\\..\\..\\..\\..\\..\\tiles\\zurich.mbtiles";

IVectorTileConverter? _tileConverter;
List<Tile> _tiles = new List<Tile> { new Tile(134, 166, 8), new Tile(8580, 10645, 14), new Tile(8581, 10645, 14), new Tile(8580, 10644, 14) };
List<byte[]?> _data = new List<byte[]?>();

[GlobalSetup]
public void Setup()
{
var dataSource = new MBTilesSQLiteDataSource(_path);

_tileConverter = new MapboxTileConverter(dataSource);

foreach (var tile in _tiles)
_data.Add(dataSource.GetTileAsync(tile).ConfigureAwait(false).GetAwaiter().GetResult());
}

[Benchmark]
[Arguments(0)]
[Arguments(1)]
[Arguments(2)]
[Arguments(3)]
public void ReadVectorTile(int i)
{
_tileConverter?.ConvertToVectorTile(_tiles[i], _data[i])
.ConfigureAwait(false)
.GetAwaiter()
.GetResult();
}

[Benchmark]
public void ReadVectorTiles()
{
for (var i = 0; i < _tiles.Count(); i++)
_tileConverter?.ConvertToVectorTile(_tiles[i], _data[i])
.ConfigureAwait(false)
.GetAwaiter()
.GetResult();
}
}
}
4 changes: 4 additions & 0 deletions benchmarks/VexTile.VectorTileReaders.Benchmarks/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
using BenchmarkDotNet.Running;
using VexTile.VectorTileReaders.Benchmarks;

BenchmarkRunner.Run<Benchmarks>();
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" />
<PackageReference Include="sqlite-net-pcl" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\source\converters\VexTile.Converter.Mapbox\VexTile.Converter.Mapbox.csproj" />
<ProjectReference Include="..\..\source\DataSources\VexTile.DataSource.MBTilesSQLite\VexTile.DataSource.MBTilesSQLite.csproj" />
<ProjectReference Include="..\..\source\Readers\VexTile.Readers\VexTile.Converter.Mapbox.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public async Task BasicFactoryRenderTest()

string path = "zurich.mbtiles";

SQLiteConnectionString val = new SQLiteConnectionString(path, (SQLiteOpenFlags)1, false);
var val = new SQLiteConnectionString(path, (SQLiteOpenFlags)1, false);
var provider = new VectorTilesSource(new SQLiteConnection(val));
style.SetSourceProvider("openmaptiles", provider);
var tile = await TileRendererFactory.RenderAsync(style, canvas, 0, 0, 0);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using NetTopologySuite.IO.VectorTiles.Tiles;
using VexTile.Common.Sources;

namespace VexTile.DataSource.MBTilesFolder;

public class MBTilesFolderDataSource : IDataSource
{
public MBTilesFolderDataSource(string path = ".\\")
{
Path = path;
}

public string Path { get; }

public async Task<byte[]?> GetTileAsync(Tile tile)
{
string qualifiedPath = Path
.Replace("{x}", tile.X.ToString())
.Replace("{y}", tile.Y.ToString())
.Replace("{z}", tile.Zoom.ToString());

if (!File.Exists(qualifiedPath))
return null;

byte[]? result = null;

await new Task(() => new Task(() => File.ReadAllBytes(qualifiedPath)).RunSynchronously());

return result;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net8.0;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\VexTile.Common\VexTile.Common.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.

// This file was created by Felix Obermaier (www.ivv-aachen.de) 2011.

namespace VexTile.DataSource.MBTilesSQLite;

/// <summary>
/// Image format of tiles
/// </summary>
public enum MbTilesFormat
{
/// <summary>
/// Portable Network Graphics (PNG)
/// </summary>
Png,

/// <summary>
/// Joint Photographic Experts Group (JPEG)
/// </summary>
Jpg,

/// <summary>
/// Joint Photographic Experts Group (JPEG)
/// </summary>
Jpeg = Jpg,

/// <summary>
/// Webp format
/// </summary>
Webp,

/// <summary>
/// Protobuf vector format
/// </summary>
Pbf
}
Loading