Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make a first experiment with 3d tiles #569

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Drabble
Copy link
Contributor

@Drabble Drabble commented Jan 4, 2023

As described in #568. We should start to experiment generating 3d tiles from OSM data to apply extrusion on buildings and render them in Cesium.

I have made a first experiment with the most simple setup:

  1. I have a simple 3d tileset.json which defines an implicit tiling in a quad tree.
  2. Each subtree in the implicit tiling basically sets availability of all tiles and subtrees to a constant of 1.
  3. Each tile's content is a GLTF file which contains the extruded OSM buildings. To get the buildings I query a PostGIS database that already contains all of the OSM data. Then I tessellate them using JTS and extrude them manually.
  4. Finally I use JglTF to generate the GLTF binary. I serve everything with a simple JAX-RS web server.

On the JAX-RS server, I serve a simple index.html file that uses Cesium to render the 3d tiles.

Here is a preview:

image

image

Screencast.from.05-01-23.14_50_02.mp4

Any input or improvement is welcome. The goal of this work is to make experimentations to discover the 3d tiles and GLTF specifications. I have learnt a lot of interesting things by working on this example and there is so much more that could be done.

One thing that would be interesting to explore is to use the ADD refinement type instead of the REPLACE refinement type. See here. This way we could additively load new buildings instead of overwriting them at each tile level.

Other possibilities include:

  • Adding terrain under the buildings and render them on a height map.
  • Applying some textures on the buildings maybe
  • Adding roof shapes based on OSM roof shape tags
  • Embedding 3d meshes such as the eiffel tower from OSM metadata as well.

There are endless possibilities and optimisations. If anyone is interested, I would be happy to discuss it.

@Drabble Drabble added enhancement New feature or request help wanted Extra attention is needed labels Jan 4, 2023
@Drabble Drabble self-assigned this Jan 4, 2023
@Drabble Drabble linked an issue Jan 4, 2023 that may be closed by this pull request
@Drabble Drabble removed their assignment Jan 4, 2023
@Drabble Drabble marked this pull request as draft January 4, 2023 16:02
@sonarcloud
Copy link

sonarcloud bot commented Jan 5, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 10 Code Smells

0.0% 0.0% Coverage
1.7% 1.7% Duplication

@Drabble
Copy link
Contributor Author

Drabble commented Jan 5, 2023

@javagl I had a good time working with JglTF, even if this is a very raw and basic example. I see that you have been actively contributing to 3d-tiles as well. Thank you so much for all of your hard work and your contributions to the 3d-tiles community. I hope we'll be able to improve this example in the future to make a better use of all the amazing features of these specifications.

@javagl
Copy link

javagl commented Jan 5, 2023

Thanks for the heads-up. I'll definitely have a closer look at the implementation (and the broader context of baremaps) here.
(BTW: If you have any feedback or suggestions about JglTF from your perspective, feel free to bring it up as an issue there)

@sonarcloud
Copy link

sonarcloud bot commented May 26, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug C 1 Bug
Vulnerability A 0 Vulnerabilities
Security Hotspot E 1 Security Hotspot
Code Smell A 10 Code Smells

No Coverage information No Coverage information
1.6% 1.6% Duplication

Copy link

sonarcloud bot commented Nov 27, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug C 1 Bug
Vulnerability A 0 Vulnerabilities
Security Hotspot E 1 Security Hotspot
Code Smell A 11 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

String buildingLevels = resultSet.getString(4);
float finalHeight = 10;
if (buildingHeight != null) {
finalHeight = Float.parseFloat(buildingHeight.replaceAll("[^0-9]", ""));

Check notice

Code scanning / CodeQL

Missing catch of NumberFormatException Note

Potential uncaught 'java.lang.NumberFormatException'.
if (buildingHeight != null) {
finalHeight = Float.parseFloat(buildingHeight.replaceAll("[^0-9]", ""));
} else if (height != null) {
finalHeight = Float.parseFloat(height.replaceAll("[^0-9]", ""));

Check notice

Code scanning / CodeQL

Missing catch of NumberFormatException Note

Potential uncaught 'java.lang.NumberFormatException'.
} else if (height != null) {
finalHeight = Float.parseFloat(height.replaceAll("[^0-9]", ""));
} else if (buildingLevels != null) {
finalHeight = Float.parseFloat(buildingLevels.replaceAll("[^0-9]", "")) * 3;

Check notice

Code scanning / CodeQL

Missing catch of NumberFormatException Note

Potential uncaught 'java.lang.NumberFormatException'.
}

@Get("regex:^/subtrees/(?<level>[0-9]+).(?<x>[0-9]+).(?<y>[0-9]+).json")
public HttpResponse getSubtree(@Param("level") int level, @Param("x") int x, @Param("y") int y) {

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'x' is never used.
}

@Get("regex:^/subtrees/(?<level>[0-9]+).(?<x>[0-9]+).(?<y>[0-9]+).json")
public HttpResponse getSubtree(@Param("level") int level, @Param("x") int x, @Param("y") int y) {

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'y' is never used.
Copy link

sonarcloud bot commented Mar 25, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Experiment with 3d tiles
3 participants