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

Issue with 3D Transformation of Pipeline Data #162

Closed
plaulhe opened this issue May 7, 2024 · 9 comments
Closed

Issue with 3D Transformation of Pipeline Data #162

plaulhe opened this issue May 7, 2024 · 9 comments

Comments

@plaulhe
Copy link

plaulhe commented May 7, 2024

Problem Description
I am currently experiencing an issue when transforming pipeline data into 3D using the pg2b3dm tool. Initially, my data is stored in a 2D format in a GeoPackage (gpkg) file. I import this data into a PostgreSQL database following your tutorial, then transform it into 3D using the ST_Force3D function of PostGIS. However, when I try to convert these 3D data into 3D tiles with pg2b3dm, I encounter an error that I cannot resolve.

Steps to Reproduce the Problem

  • Import pipeline data stored in a GeoPackage file into a PostgreSQL database.

  • Transform this data into 3D using the ST_Force3D function of PostGIS with the following query:

DROP TABLE IF EXISTS a_collec_line_3D;
CREATE TABLE pipeline_3D AS
SELECT id, codinsee, zaval, zamont, hauteur, ST_Force3D (geom, 2) as geom
FROM pipeline;

  • Add a radius field to the a_collec_line_3D table.

  • Use the pg2b3dm tool to convert the 3D data into 3D tiles with the following command:

docker run -ti geodan/pg2b3dm -U postgres -h 172.17.0.1 -d adl -c geom -t pipeline_3d -p 4555 -o /var/lib/postgresql/data --radiuscolumn radius

Expected Behavior
I expect the 3D pipeline data to be successfully converted into 3D tiles, ready to be visualized in applications compatible with 3D tiles, such as CesiumJS.

Observed Behavior
When I try to convert the 3D data into 3D tiles with pg2b3dm, I encounter an "Unhandled exception" error with the following message:

Unhandled exception. System.InvalidCastException: Unable to cast object of type 'Wkx.Polygon' to type 'Wkx.PolyhedralSurface'.
at B3dm.Tileset.GeometryRepository.GetGeometriesBoundingBox(NpgsqlConnection conn, String geometry_table, String geometry_column, Int32 epsg, Tile t, String query) in /src/b3dm.tileset/GeometryRepository.cs:line 30
at pg2b3dm.QuadtreeTiler.GenerateTiles(BoundingBox bbox, Tile tile, List1 tiles, Int32 lod, Boolean addOutlines, String defaultColor, String defaultMetallicRoughness, Boolean doubleSided, Boolean createGltf) in /src/b3dm.tileset/QuadtreeTiler.cs:line 132 at pg2b3dm.Program.<>c__DisplayClass2_0.<Main>b__0(Options o) in /src/pg2b3dm/Program.cs:line 187 at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult1 result, Action`1 action)
at pg2b3dm.Program.Main(String[] args) in /src/pg2b3dm/Program.cs:line 25

What i don't understand is that, i only have linestring Z geometries. So why the error concerne polygone???

I am aware that I am a novice in the field of 3D transformation and may be missing something trivial. Any help or suggestions to solve this problem would be greatly appreciated.

Is it possible to have an input example to compare with mine?

Thank you very much for your assistance!

@bertt
Copy link
Member

bertt commented May 15, 2024

Hi, I can reproduce this when all the z values are the same. Is that the case? Workaround for now is to use some different z values.

@bertt
Copy link
Member

bertt commented May 16, 2024

I've created a PR to fix this, it will be in next release #164

@plaulhe
Copy link
Author

plaulhe commented May 16, 2024 via email

@plaulhe
Copy link
Author

plaulhe commented May 16, 2024

it works perfectly. thanks a lot

@bertt
Copy link
Member

bertt commented May 16, 2024

nice, closing this issue

@alexaac
Copy link

alexaac commented Jun 20, 2024

I've created a PR to fix this, it will be in next release #164

Hi, I'm facing the same issue for pg2b3dm version 2.8.1.0.
Does this version include the changes from release #164?
Thanks

Screenshot from 2024-06-20 10-13-02
Screenshot from 2024-06-20 10-13-26

@bertt
Copy link
Member

bertt commented Jun 20, 2024

no I'll create a new release 2.8.2

@bertt
Copy link
Member

bertt commented Jun 20, 2024

2.8.2 is released

@alexaac
Copy link

alexaac commented Jun 20, 2024

2.8.2 is released

That's great, thanks. 🙏 Meanwhile, I've added random small values to z, to make it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants