Skip to content

Commit

Permalink
Merge branch 'master' into remove_option_shaderscolumn
Browse files Browse the repository at this point in the history
  • Loading branch information
bertt authored Jul 17, 2024
2 parents a7b57d2 + 8f6b94d commit eb16069
Show file tree
Hide file tree
Showing 19 changed files with 300 additions and 129 deletions.
33 changes: 7 additions & 26 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,22 @@ name: Build server status

on:
push:
branches: [ master ]
branches: [ '**' ]
pull_request:
branches: [ '**' ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
dotnet-version: 8.0.x
- name: Build with dotnet
working-directory: src
run: dotnet build --configuration Release
- name: Testing glb
working-directory: src/wkb2gltf.core.tests
run: dotnet test
- name: Testing tileset
working-directory: src/b3dm.tileset.tests
run: dotnet test

publishdocker:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build ./src --file ./src/Dockerfile --tag geodan/pg2b3dm:latest
- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Publish the Docker image
run: docker push geodan/pg2b3dm:latest
- name: Testing
working-directory: src
run: dotnet test
77 changes: 77 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Publish

permissions:
contents: write

on:
push:
tags:
- v*
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Build
run: echo ${{ github.sha }} > Release.txt
- name: Test
run: cat Release.txt

- name: Build and publish
run: |
architectures=(win-x64 osx-x64 linux-x64 win-arm64 osx-arm64 linux-arm64)
for arch in "${architectures[@]}"; do
dotnet publish src/pg2b3dm -c Release -r "$arch" /p:PublishSingleFile=true
cd src/pg2b3dm/bin/Release/net8.0/"$arch"/publish
zip -r ../../../../../../../pg2b3dm-"$arch".zip *
cd ../../../../../../..
done
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
Release.txt
pg2b3dm-win-x64.zip
pg2b3dm-win-arm64.zip
pg2b3dm-osx-x64.zip
pg2b3dm-osx-arm64.zip
pg2b3dm-linux-x64.zip
pg2b3dm-linux-arm64.zip
- name: Pack
working-directory: src/pg2b3dm
run: |
dotnet build pg2b3dm.csproj --configuration Release
dotnet pack pg2b3dm.csproj --configuration Release -p:PackAsTool=true --output ./nupkg
- name: Publish to NuGet
working-directory: src/pg2b3dm
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: dotnet nuget push ./nupkg/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json

- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1
with:
strip_v: true

- name: Publish to Docker
run: |
docker build ./src --file ./src/Dockerfile --tag geodan/pg2b3dm:latest
docker push geodan/pg2b3dm:latest
docker tag geodan/pg2b3dm:latest geodan/pg2b3dm:${{ steps.tag.outputs.tag }}
docker push geodan/pg2b3dm:${{ steps.tag.outputs.tag }}
58 changes: 49 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Features:

- Cesium: LOD support and Outlines support (using CESIUM_primitive_outline);

- Triangulation of input geometries LineStrings/Polygon/MultiPolygon/PolyhedralSurface with Z values;
- Triangulation of input geometries LineStrings/Polygon/MultiPolygon/PolyhedralSurface/TIN with Z values;

- Docker support.

Expand All @@ -36,13 +36,13 @@ Convert 3D Data (Multipolygon Z) to 3D Tiles

### Prerequisites

- PostGIS database
- Install latest executable pg2b3dm for your platform (see https://github.com/Geodan/pg2b3dm/releases)

- .NET 6.0 SDK https://dotnet.microsoft.com/download/dotnet/6.0
- PostGIS database

- GDAL (ogr2ogr)

Check PostGIS:
Optional check PostGIS:

```
$ postgresql> select ST_AsText(ST_Transform(ST_GeomFromText('POINT(121302 487371 2.68)', 7415), 4979));
Expand Down Expand Up @@ -206,13 +206,34 @@ If --username and/or --dbname are not specified the current username is used as
Sample command for running pg2b3dm:

```
-h localhost -U postgres -c geom_triangle -t delaware_buildings -d postgres -g 100,0
$ pg2b3dm -h localhost -U postgres -c geom_triangle -t delaware_buildings -d postgres -g 100,0
```

Database password will be asked to create the database connection, unless:

- Trusted authentication is enabled;

- Environment variable 'PGPASSWORD' is set.

## Installation

### Pre-built binaries

See Releases https://github.com/Geodan/pg2b3dm/releases for pre-built binaries for Windows, Linux and OSX. Binaries are available for X64 and ARM.

Prerequisite: .NET 6.0 SDK is installed https://dotnet.microsoft.com/download/dotnet/6.0
Sample Windows installation (note use correct version):

```
$ wget https://github.com/Geodan/pg2b3dm/releases/download/{version}/pg2b3dm-win-x64.zip
$ unzip pg2b3dm-win-x64.zip
$ pg2b3dm
```

### .NET tool

As alternative use .NET 8.0 SDK to install the tool:

Prerequisite: .NET 8.0 SDK is installed https://dotnet.microsoft.com/download/dotnet/6.0

```
$ dotnet tool install -g pg2b3dm
Expand All @@ -230,6 +251,15 @@ To run:
$ pg2b3dm
```

### Docker

To run the latest Docker image:

```
$ docker pull geodan/pg2b3dm
$ docker run geodan/pg2b3dm
```

## Benchmarking

| Source | Table | Size | Features | Time | Tiles | Tiles/Minute | Tile uncompressed | Tile compressed |
Expand Down Expand Up @@ -453,9 +483,9 @@ $ docker run -v $(pwd)/output:/app/output -it geodan/pg2b3dm -h my_host -U my_us

## Run from source

Requirement: Install .NET 6.0 SDK
Requirement: Install .NET 8.0 SDK

https://dotnet.microsoft.com/download/dotnet/6.0
https://dotnet.microsoft.com/download/dotnet/8.0

Installation guide see https://docs.microsoft.com/en-us/dotnet/core/install/

Expand All @@ -473,7 +503,7 @@ To create an self-contained executable '~/bin/pg2b3dm' for Linux:
$ git clone https://github.com/Geodan/pg2b3dm.git
$ cd pg2b3dm/src/pg2b3dm
$ dotnet publish -c Release -r linux-x64 /p:PublishSingleFile=true
$ cp ./bin/Release/net6.0/linux-x64/publish/pg2b3dm ~/bin
$ cp ./bin/Release/net8.0/linux-x64/publish/pg2b3dm ~/bin
$ ~/bin/pg2b3dm
```

Expand Down Expand Up @@ -515,6 +545,16 @@ Press F5 to start debugging.

## History

2024-07-17: release 2.11.1: fix .NET 8.0 release

2024-07-17: release 2.11: from .NET 6 .0 to .NET 8.0

2024-07-16: release 2.10.1: add pre-built release binaries for Windows/Linux/IOS (for X64 and ARM)

2024-07-10: release 2.10.0: add Github releases for Windows and Linux

2024-07-04: release 2.9.0: add TIN geometry support (https://github.com/Geodan/pg2b3dm/pull/178 by [@sebastianmattar] (https://www.github.com/sebastianmattar))

2024-06-20: release 2.8.2: fix lines with constant z values + improve outlines

2024-04-09: release 2.8.1: no rounding of bounding volume values
Expand Down
2 changes: 1 addition & 1 deletion getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Donwload zip, unzip. It contains a 'bldg_footprints.shp' shapefile with building

- PostGIS database

- .NET 6.0 SDK https://dotnet.microsoft.com/download/dotnet/6.0
- .NET 8.0 SDK https://dotnet.microsoft.com/download/dotnet/8.0

- GDAL (ogr2ogr)

Expand Down
4 changes: 2 additions & 2 deletions src/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0 as build
FROM mcr.microsoft.com/dotnet/sdk:8.0 as build
WORKDIR /src
COPY . .
RUN dotnet build "pg2b3dm/pg2b3dm.csproj" -c Release
RUN dotnet publish "pg2b3dm/pg2b3dm.csproj" -c Release -o /app

FROM mcr.microsoft.com/dotnet/runtime:6.0
FROM mcr.microsoft.com/dotnet/runtime:8.0
WORKDIR /app
COPY --from=build /app /app/
ENTRYPOINT ["dotnet", "pg2b3dm.dll"]
2 changes: 1 addition & 1 deletion src/b3dm.tileset.tests/b3dm.tileset.tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
<RootNamespace>B3dm.Tileset.Tests</RootNamespace>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand Down
2 changes: 1 addition & 1 deletion src/b3dm.tileset/GeometricErrorCalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ public static double[] GetGeometricErrors(double maxGeometricError, List<int> lo
res.Add(0);
}

return res.ToArray(); ;
return res.ToArray();
}
}
7 changes: 5 additions & 2 deletions src/b3dm.tileset/b3dm.tileset.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>B3dm.Tileset</RootNamespace>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
Expand All @@ -11,7 +11,10 @@
<PackageReference Include="subtree" Version="1.4.7" />
</ItemGroup>

<ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>none</DebugType>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\wkb2gltf.core\wkb2gltf.csproj" />
</ItemGroup>

Expand Down
2 changes: 0 additions & 2 deletions src/pg2b3dm.database.tests/Dockerfile

This file was deleted.

15 changes: 2 additions & 13 deletions src/pg2b3dm.database.tests/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
# Database tests

To run these tests, run the Docker database with test table first.

Build:

```
$ docker build -t delaware .
```

Run:

```
$ docker run -e POSTGRES_PASSWORD=postgres -p 5433:5432 delaware
```
In these tests, a database is used containing some test data. The database is a PostgreSQL database with PostGIS extension.
The database is run in a Docker container and is managed by testcontainers (https://testcontainers.com/).
Loading

0 comments on commit eb16069

Please sign in to comment.