From f0950edf50e71c32cc733652310a91b63c471e7c Mon Sep 17 00:00:00 2001 From: Matt Johnson-Pint Date: Sun, 26 Jan 2025 11:49:49 -0800 Subject: [PATCH 1/5] Update targets --- src/GeoTimeZone.DataBuilder/GeoTimeZone.DataBuilder.csproj | 2 +- src/GeoTimeZone/GeoTimeZone.csproj | 2 +- .../GeoTimeZone.DataBuilder.Tests.csproj | 2 +- test/GeoTimeZone.Tests/GeoTimeZone.Tests.csproj | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/GeoTimeZone.DataBuilder/GeoTimeZone.DataBuilder.csproj b/src/GeoTimeZone.DataBuilder/GeoTimeZone.DataBuilder.csproj index 64326a5..17dd40c 100644 --- a/src/GeoTimeZone.DataBuilder/GeoTimeZone.DataBuilder.csproj +++ b/src/GeoTimeZone.DataBuilder/GeoTimeZone.DataBuilder.csproj @@ -1,7 +1,7 @@ - net6.0 + net9.0 Exe false diff --git a/src/GeoTimeZone/GeoTimeZone.csproj b/src/GeoTimeZone/GeoTimeZone.csproj index 1314837..b5091cc 100644 --- a/src/GeoTimeZone/GeoTimeZone.csproj +++ b/src/GeoTimeZone/GeoTimeZone.csproj @@ -3,7 +3,7 @@ Provides an IANA time zone identifier from latitude and longitude coordinates. Matt Johnson-Pint,Simon Bartlett - net6.0;netstandard2.1;netstandard2.0;net462 + netstandard2.0;netstandard2.1;net462;net6.0;net8.0;net9.0 GeoTimeZone timezone;time;zone;geolocation;geo;latitude;longitude;coordinates;iana;tzdb https://github.com/mattjohnsonpint/GeoTimeZone diff --git a/test/GeoTimeZone.DataBuilder.Tests/GeoTimeZone.DataBuilder.Tests.csproj b/test/GeoTimeZone.DataBuilder.Tests/GeoTimeZone.DataBuilder.Tests.csproj index 524469d..ceca64d 100644 --- a/test/GeoTimeZone.DataBuilder.Tests/GeoTimeZone.DataBuilder.Tests.csproj +++ b/test/GeoTimeZone.DataBuilder.Tests/GeoTimeZone.DataBuilder.Tests.csproj @@ -1,7 +1,7 @@ - net6.0 + net9.0 diff --git a/test/GeoTimeZone.Tests/GeoTimeZone.Tests.csproj b/test/GeoTimeZone.Tests/GeoTimeZone.Tests.csproj index 4f8e39f..5b13b77 100644 --- a/test/GeoTimeZone.Tests/GeoTimeZone.Tests.csproj +++ b/test/GeoTimeZone.Tests/GeoTimeZone.Tests.csproj @@ -1,7 +1,7 @@ - net6.0 + net9.0 From f6eb3d6e9373c2fbb1fa8ccec5e44028fa7acf7f Mon Sep 17 00:00:00 2001 From: Matt Johnson-Pint Date: Sun, 26 Jan 2025 11:50:51 -0800 Subject: [PATCH 2/5] Bump dependencies --- Directory.Build.props | 2 +- test/Directory.Build.props | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 54cc94f..5b98c96 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -11,7 +11,7 @@ - + diff --git a/test/Directory.Build.props b/test/Directory.Build.props index 3872002..c3587f9 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -3,15 +3,22 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - + + + + + + + + + + + @@ -19,7 +26,7 @@ - + From d6c27ad821866c1486ebd086344cc5c01d12c7d7 Mon Sep 17 00:00:00 2001 From: Matt Johnson-Pint Date: Sun, 26 Jan 2025 12:05:46 -0800 Subject: [PATCH 3/5] Update shapefile reader --- .../GeoTimeZone.DataBuilder.csproj | 2 +- .../TimeZoneShapeFileReader.cs | 20 ++++--------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/GeoTimeZone.DataBuilder/GeoTimeZone.DataBuilder.csproj b/src/GeoTimeZone.DataBuilder/GeoTimeZone.DataBuilder.csproj index 17dd40c..c5f50d3 100644 --- a/src/GeoTimeZone.DataBuilder/GeoTimeZone.DataBuilder.csproj +++ b/src/GeoTimeZone.DataBuilder/GeoTimeZone.DataBuilder.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/GeoTimeZone.DataBuilder/TimeZoneShapeFileReader.cs b/src/GeoTimeZone.DataBuilder/TimeZoneShapeFileReader.cs index 8871ea9..9979498 100644 --- a/src/GeoTimeZone.DataBuilder/TimeZoneShapeFileReader.cs +++ b/src/GeoTimeZone.DataBuilder/TimeZoneShapeFileReader.cs @@ -1,6 +1,4 @@ -using NetTopologySuite.Features; -using NetTopologySuite.Geometries; -using NetTopologySuite.IO; +using NetTopologySuite.IO.Esri; namespace GeoTimeZone.DataBuilder; @@ -15,27 +13,17 @@ public TimeZoneShapeFileReader(string shapeFile) public IEnumerable ReadShapeFile() { - using var reader = new ShapefileDataReader(_shapeFile, GeometryFactory.Default); - var header = reader.DbaseHeader; - - while (reader.Read()) + foreach (var feature in Shapefile.ReadAllFeatures(_shapeFile)) { - var attributes = new AttributesTable(); - for (var i = 0; i < header.NumFields; i++) - { - var name = header.Fields[i].Name; - var value = reader.GetValue(i + 1); - attributes.Add(name, value); - } + var zone = (string) feature.Attributes["tzid"]; // skip uninhabited areas - var zone = (string) attributes["tzid"]; if (zone.Equals("uninhabited", StringComparison.OrdinalIgnoreCase)) { continue; } - yield return new TimeZoneFeature(zone, reader.Geometry); + yield return new TimeZoneFeature(zone, feature.Geometry); } } } From d5583d301f738a6821a0ebed21f2cb988d61011d Mon Sep 17 00:00:00 2001 From: Matt Johnson-Pint Date: Sun, 26 Jan 2025 12:19:10 -0800 Subject: [PATCH 4/5] Bump workflows --- .github/workflows/build.yaml | 8 ++++++++ .github/workflows/pack-for-release.yaml | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4a585a0..7f4c2c5 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,6 +19,14 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - name: Install .NET SDKs + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 6.0.x + 8.0.x + 9.0.x + - name: Restore run: dotnet restore --nologo diff --git a/.github/workflows/pack-for-release.yaml b/.github/workflows/pack-for-release.yaml index 7dacf70..605701d 100644 --- a/.github/workflows/pack-for-release.yaml +++ b/.github/workflows/pack-for-release.yaml @@ -15,6 +15,14 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - name: Install .NET SDKs + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 6.0.x + 8.0.x + 9.0.x + - name: Restore run: dotnet restore --nologo From e105ef11dc8299026c509b96878a09f1a0c64529 Mon Sep 17 00:00:00 2001 From: Matt Johnson-Pint Date: Sun, 26 Jan 2025 12:21:57 -0800 Subject: [PATCH 5/5] . --- .github/workflows/build.yaml | 4 ++-- .../workflows/{pack-for-release.yaml => release.yaml} | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) rename .github/workflows/{pack-for-release.yaml => release.yaml} (81%) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7f4c2c5..81a01bf 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -12,12 +12,12 @@ env: jobs: build: - name: Build + name: Build / Test runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install .NET SDKs uses: actions/setup-dotnet@v4 diff --git a/.github/workflows/pack-for-release.yaml b/.github/workflows/release.yaml similarity index 81% rename from .github/workflows/pack-for-release.yaml rename to .github/workflows/release.yaml index 605701d..6fa63aa 100644 --- a/.github/workflows/pack-for-release.yaml +++ b/.github/workflows/release.yaml @@ -1,4 +1,4 @@ -name: pack-for-release +name: release on: workflow_dispatch: @@ -13,7 +13,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install .NET SDKs uses: actions/setup-dotnet@v4 @@ -38,8 +38,11 @@ jobs: - name: Pack run: dotnet pack -c Release --nologo --no-build + - name: Push to NuGet + run: dotnet nuget push -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}} **/*.nupkg + - name: Archive Artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: nuget-packages path: src/**/Release/*.*nupkg