Skip to content

Commit 49d008d

Browse files
authored
Initial release v1.0
2 parents a42288e + 361dc9e commit 49d008d

File tree

81 files changed

+40521
-177
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+40521
-177
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*.cs]
4+
indent_style = space
5+
indent_size = 4
6+
trim_trailing_whitespace = true
7+
insert_final_newline = true
8+
dotnet_style_predefined_type_for_locals_parameters_members = true:error
9+
dotnet_style_predefined_type_for_member_access = true:error
10+
csharp_style_var_for_built_in_types = false:error
11+
csharp_style_var_when_type_is_apparent = true:error
12+
csharp_style_var_elsewhere = true:error

.github/workflows/dotnetcore.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,10 @@ jobs:
2121
- name: Get source
2222
uses: actions/checkout@v1
2323

24-
# Get runtimes
25-
- name: Setup .NET Core 3.1
24+
- name: Setup .NET Core 6.
2625
uses: actions/setup-dotnet@v1
2726
with:
28-
dotnet-version: 3.1.100
29-
- name: Setup .NET Core 5.
30-
uses: actions/setup-dotnet@v1
31-
with:
32-
dotnet-version: 5.0.101
27+
dotnet-version: 6.0.x
3328

3429
- name: Restore packages.
3530
run: dotnet restore

.github/workflows/prerelease.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: prerelease
2+
3+
on:
4+
push:
5+
branches: [ develop ]
6+
7+
jobs:
8+
build-and-test:
9+
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Get source
14+
uses: actions/checkout@v2
15+
with:
16+
submodules: 'true'
17+
- name: Setup .NET Core 6.
18+
uses: actions/setup-dotnet@v1
19+
with:
20+
dotnet-version: 6.0.x
21+
- name: Restore packages.
22+
run: dotnet restore
23+
- name: Build all projects.
24+
run: dotnet build --configuration Release --no-restore
25+
26+
- name: Unittests.
27+
run: dotnet test
28+
working-directory: ./test/NetTopologySuite.IO.VectorTiles.Tests/
29+
- name: Functional tests.
30+
run: dotnet run -c release
31+
working-directory: ./test/NetTopologySuite.IO.VectorTiles.Tests.Functional/
32+
33+
- name: Nuget Pack
34+
run: dotnet pack -c release
35+
working-directory: ./src/NetTopologySuite.IO.VectorTiles/
36+
- name: Nuget Pack
37+
run: dotnet pack -c release
38+
working-directory: ./src/NetTopologySuite.IO.VectorTiles.Mapbox/
39+
- name: Nuget Pack
40+
run: dotnet pack -c release
41+
working-directory: ./src/NetTopologySuite.IO.VectorTiles.GeoJson/
42+
43+
- name: Nuget push
44+
run: dotnet nuget push **/*.nupkg --skip-duplicate -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/NetTopologySuite/index.json
45+
working-directory: ./src/

.github/workflows/release.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,10 @@ jobs:
1414
uses: actions/checkout@v2
1515
with:
1616
submodules: 'true'
17-
- name: Setup .NET Core 3.1
17+
- name: Setup .NET Core 6.
1818
uses: actions/setup-dotnet@v1
1919
with:
20-
dotnet-version: 3.1.301
21-
- name: Setup .NET Core 5.
22-
uses: actions/setup-dotnet@v1
23-
with:
24-
dotnet-version: 5.0.101
20+
dotnet-version: 6.0.x
2521
- name: Restore packages.
2622
run: dotnet restore
2723
- name: Build all projects.
@@ -44,6 +40,11 @@ jobs:
4440
run: dotnet pack -c release
4541
working-directory: ./src/NetTopologySuite.IO.VectorTiles.GeoJson/
4642

47-
- name: Nuget push
43+
- name: Nuget push Github
4844
run: dotnet nuget push **/*.nupkg --skip-duplicate -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/NetTopologySuite/index.json
4945
working-directory: ./src/
46+
47+
- name: Nuget push Nuget
48+
run: dotnet nuget push **/*.nupkg --skip-duplicate -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
49+
shell: bash
50+
working-directory: ./src/

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,6 @@ workingdir*/
5050
log.txt
5151

5252
.idea
53-
.idea/*
53+
.idea/*
54+
55+
test/NetTopologySuite.IO.VectorTiles.Samples/wwwroot/tiles/

NetTopologySuite.IO.VectorTiles.Common.props

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@
66
<LangVersion>latest</LangVersion>
77
<Authors>NetTopologySuite - Team</Authors>
88
<Owners>NetTopologySuite - Team</Owners>
9-
<PackageVersion>0.0.16</PackageVersion>
10-
<PackageLicenseUrl>https://raw.githubusercontent.com/NetTopologySuite/NetTopologySuite.IO.VectorTiles/main/LICENSE.md</PackageLicenseUrl>
9+
<PackageVersion>1.0.0</PackageVersion>
10+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1111
<RepositoryUrl>https://github.com/NetTopologySuite/NetTopologySuite.IO.VectorTiles</RepositoryUrl>
12-
<PackageIconUrl>https://github.com/NetTopologySuite/NetTopologySuite/raw/develop/icon.png</PackageIconUrl>
12+
<PackageIcon>icon.png</PackageIcon>
1313
</PropertyGroup>
14+
15+
<ItemGroup>
16+
<None Include="$(MSBuildThisFileDirectory)icon.png" Pack="true" PackagePath="\" />
17+
</ItemGroup>
18+
1419
</Project>

NetTopologySuite.IO.VectorTiles.sln

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.31515.178
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.1.32328.378
55
MinimumVisualStudioVersion = 15.0.26124.0
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5AB5EA50-565A-4248-BE53-7C44C59D75BD}"
77
EndProject
@@ -27,9 +27,18 @@ EndProject
2727
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "github", "github", "{BE52ABAC-CB7A-4F21-96E1-F95D1113376A}"
2828
ProjectSection(SolutionItems) = preProject
2929
.github\workflows\dotnetcore.yml = .github\workflows\dotnetcore.yml
30+
.github\workflows\prerelease.yml = .github\workflows\prerelease.yml
3031
.github\workflows\release.yml = .github\workflows\release.yml
3132
EndProjectSection
3233
EndProject
34+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B55BEE7D-673C-497A-9E6B-8C0E5346DE9D}"
35+
ProjectSection(SolutionItems) = preProject
36+
.editorconfig = .editorconfig
37+
NetTopologySuite.IO.VectorTiles.Common.props = NetTopologySuite.IO.VectorTiles.Common.props
38+
EndProjectSection
39+
EndProject
40+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NetTopologySuite.IO.VectorTiles.Samples", "test\NetTopologySuite.IO.VectorTiles.Samples\NetTopologySuite.IO.VectorTiles.Samples.csproj", "{354BA55A-392E-4CAC-9DD3-C3A12B82EB7B}"
41+
EndProject
3342
Global
3443
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3544
Debug|Any CPU = Debug|Any CPU
@@ -100,6 +109,18 @@ Global
100109
{F27586C9-F06A-4B45-A034-1B57B9FBD394}.Release|x64.Build.0 = Release|Any CPU
101110
{F27586C9-F06A-4B45-A034-1B57B9FBD394}.Release|x86.ActiveCfg = Release|Any CPU
102111
{F27586C9-F06A-4B45-A034-1B57B9FBD394}.Release|x86.Build.0 = Release|Any CPU
112+
{354BA55A-392E-4CAC-9DD3-C3A12B82EB7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
113+
{354BA55A-392E-4CAC-9DD3-C3A12B82EB7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
114+
{354BA55A-392E-4CAC-9DD3-C3A12B82EB7B}.Debug|x64.ActiveCfg = Debug|Any CPU
115+
{354BA55A-392E-4CAC-9DD3-C3A12B82EB7B}.Debug|x64.Build.0 = Debug|Any CPU
116+
{354BA55A-392E-4CAC-9DD3-C3A12B82EB7B}.Debug|x86.ActiveCfg = Debug|Any CPU
117+
{354BA55A-392E-4CAC-9DD3-C3A12B82EB7B}.Debug|x86.Build.0 = Debug|Any CPU
118+
{354BA55A-392E-4CAC-9DD3-C3A12B82EB7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
119+
{354BA55A-392E-4CAC-9DD3-C3A12B82EB7B}.Release|Any CPU.Build.0 = Release|Any CPU
120+
{354BA55A-392E-4CAC-9DD3-C3A12B82EB7B}.Release|x64.ActiveCfg = Release|Any CPU
121+
{354BA55A-392E-4CAC-9DD3-C3A12B82EB7B}.Release|x64.Build.0 = Release|Any CPU
122+
{354BA55A-392E-4CAC-9DD3-C3A12B82EB7B}.Release|x86.ActiveCfg = Release|Any CPU
123+
{354BA55A-392E-4CAC-9DD3-C3A12B82EB7B}.Release|x86.Build.0 = Release|Any CPU
103124
EndGlobalSection
104125
GlobalSection(SolutionProperties) = preSolution
105126
HideSolutionNode = FALSE
@@ -110,6 +131,7 @@ Global
110131
{48EA9B12-06FC-4AEC-B51B-746E1D33F016} = {7CAC6E71-A056-4009-8BC8-E7DBA9741D4C}
111132
{48923875-3F05-4D49-B786-B6D2B1EE81E9} = {7CAC6E71-A056-4009-8BC8-E7DBA9741D4C}
112133
{F27586C9-F06A-4B45-A034-1B57B9FBD394} = {5AB5EA50-565A-4248-BE53-7C44C59D75BD}
134+
{354BA55A-392E-4CAC-9DD3-C3A12B82EB7B} = {7CAC6E71-A056-4009-8BC8-E7DBA9741D4C}
113135
EndGlobalSection
114136
GlobalSection(ExtensibilityGlobals) = postSolution
115137
SolutionGuid = {9599A88C-677E-4A66-8FCD-73FD85002EBB}

icon.png

1.43 KB
Loading

src/NetTopologySuite.IO.VectorTiles.GeoJson/GeoJsonTileWriter.cs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,61 @@
1-
using System.Collections.Generic;
1+
using System.Collections.Generic;
22
using System.IO;
33
using System.Text;
44
using NetTopologySuite.Features;
55
using Newtonsoft.Json;
66

77
namespace NetTopologySuite.IO.VectorTiles.GeoJson
88
{
9+
/// <summary>
10+
/// Writes
11+
/// </summary>
912
public static class GeoJsonTileWriter
1013
{
1114
private static readonly JsonSerializer Serializer = GeoJsonSerializer.Create();
1215

1316
/// <summary>
14-
/// Writes the tiles in a /z/x/y-{layer}.geojson folder structure.
17+
/// Writes the tiles provided in <c>VectorTileTree</c> in a /z/x/y-{layer}.geojson folder structure.
1518
/// </summary>
1619
/// <param name="tree">The tree.</param>
1720
/// <param name="path">The path.</param>
1821
/// <remarks>Replaces the files if they are already present.</remarks>
1922
public static void Write(this VectorTileTree tree, string path)
2023
{
21-
foreach (var tileId in tree)
24+
foreach (ulong tileId in tree)
2225
{
2326
var tileData = tree[tileId];
2427
foreach (var layer in tileData.Layers)
2528
{
2629
var tile = new Tiles.Tile(tileId);
27-
var zFolder = Path.Combine(path, tile.Zoom.ToString());
30+
string zFolder = Path.Combine(path, tile.Zoom.ToString());
2831
if (!Directory.Exists(zFolder)) Directory.CreateDirectory(zFolder);
29-
var xFolder = Path.Combine(zFolder, tile.X.ToString());
32+
string xFolder = Path.Combine(zFolder, tile.X.ToString());
3033
if (!Directory.Exists(xFolder)) Directory.CreateDirectory(xFolder);
31-
var file = Path.Combine(xFolder, $"{tile.Y.ToString()}-{layer.Name}.geojson");
34+
string file = Path.Combine(xFolder, $"{tile.Y}-{layer.Name}.geojson");
3235
using var stream = File.Open(file, FileMode.Create);
3336
layer.Write(stream);
3437
}
3538
}
3639
}
37-
40+
3841
/// <summary>
39-
/// Writes the tiles in a /z/x/y.mvt folder structure.
42+
/// Writes the tiles provided in <c>IEnumerable&lt;VectorTile&gt;</c> in a /z/x/y-{layer}.geojson folder structure.
4043
/// </summary>
4144
/// <param name="vectorTiles">The tiles.</param>
4245
/// <param name="path">The path.</param>
43-
/// <param name="extent">The extent.</param>
4446
/// <remarks>Replaces the files if they are already present.</remarks>
45-
public static void Write(this IEnumerable<VectorTile> vectorTiles, string path, uint extent = 4096)
47+
public static void Write(this IEnumerable<VectorTile> vectorTiles, string path)
4648
{
4749
foreach (var vectorTile in vectorTiles)
4850
{
4951
foreach (var layer in vectorTile.Layers)
5052
{
5153
var tile = new Tiles.Tile(vectorTile.TileId);
52-
var zFolder = Path.Combine(path, tile.Zoom.ToString());
54+
string zFolder = Path.Combine(path, tile.Zoom.ToString());
5355
if (!Directory.Exists(zFolder)) Directory.CreateDirectory(zFolder);
54-
var xFolder = Path.Combine(zFolder, tile.X.ToString());
56+
string xFolder = Path.Combine(zFolder, tile.X.ToString());
5557
if (!Directory.Exists(xFolder)) Directory.CreateDirectory(xFolder);
56-
var file = Path.Combine(xFolder, $"{tile.Y.ToString()}-{layer.Name}.geojson");
58+
string file = Path.Combine(xFolder, $"{tile.Y}-{layer.Name}.geojson");
5759

5860
using var stream = File.Open(file, FileMode.Create);
5961
layer.Write(stream);
@@ -106,4 +108,4 @@ public static void Write(this Layer layer, Stream stream)
106108
streamWriter.Flush();
107109
}
108110
}
109-
}
111+
}

src/NetTopologySuite.IO.VectorTiles.GeoJson/NetTopologySuite.IO.VectorTiles.GeoJson.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<LangVersion>8</LangVersion>
77
<Nullable>enable</Nullable>
88
<Title>NetTopologySuite.IO.VectorTiles.GeoJson</Title>
9+
<Description>Provides functionality to write GeoJSON tiles</Description>
910
</PropertyGroup>
1011

1112
<ItemGroup>

0 commit comments

Comments
 (0)