Geodan / pg2b3dm

Tool for creating 3D Tiles from PostGIS geometries
MIT License
349 stars 65 forks source link

Cannot Transform WKT MultiPolygonZ #155

Closed mudandstars closed 6 months ago

mudandstars commented 6 months ago

Hi there,

when running pg2b3dm on my table, I get .glb files that seem to be just simple 2D triangles (using https://gltf-viewer.donmccurdy.com/ to investigate). Mapbox also does not display anything, even though it correctly fetches the data from my server (and draco compress it before).

I use this command to generate the .glb files:

pg2b3dm --format Mapbox --zoom 18 -h localhost -U gis -p 5433 -d gis -t geometries -c geometry -o static/custom/data/pg2b3dm

I use this command to draco-compress individual files:

npx gltf-pipeline -i x_y_z.glb -o x_y_z.glb -d -b

I attach a sample geometry of mine that results in a simple 2D Triangle in this text file - it is exactly like this in my DB. These geometries are generated by a script of mine from .obj files. geometry.txt

I appreciate any help.

Thank you very much

Paul

bertt commented 6 months ago

Hi Paul, I took a quick look, what's suspicious is that st_zmin(geom), st_zmax(geom) of that geometry returns 162.6828628618381, 162.8575055476819 , but in the vertices I see min values like 155... so maybe some invalid geometry or so?

mudandstars commented 6 months ago

Hi,

thanks for the quick reply. I investigated further down the rabbit-hole and it seems my original WAVEFRONT OBJ file is incorrect. Using https://github.com/tudelft3d/val3dity to analyze my .obj file returns: "ring self-intersects or is collapsed to a line" for multiple faces.

Would you have any idea on how to fix the geometry?

Anyways, this is related to an underlying problem, so I close the issue here.

bertt commented 6 months ago

Maybe easier to do obj2gltf and add it to map? Like https://bertt.github.io/mapbox_3dtiles_samples/samples/standard/3dmodel/