Geodan / pg2b3dm

Tool for creating 3D Tiles from PostGIS geometries
MIT License
360 stars 70 forks source link

Nullable object must have a value #133

Closed YXYCZXY closed 10 months ago

YXYCZXY commented 10 months ago

After following the example, I encountered this problem. I checked the data and found no issues with it. Do you know what this problem might be?

Center (wgs84): 117.29740155849998, 31.739770081825757 Starting Cesium mode... Translation ECEF: -2489924.25,4824677,3335926 Lod column: Geometric errors: 2000,0 Refinement: REPLACE Geometric error used for implicit tiling: 2000 Add outlines: False Use 3D Tiles 1.1 implicit tiling: True Maximum features per tile: 1000 Start generating tiles... Creating tile: 1_0_0.glb Unhandled exception. System.InvalidOperationException: Nullable object must have a value. at System.Nullable1.get_Value() at Triangulate.PointExtensions.ToVector3(Point p) at Triangulate.PolygonExtensions.GetNormal(Polygon polygon) at Triangulate.Triangulator.Triangulate(Polygon inputpolygon) at Triangulate.Triangulator.GetTriangles(List1 geometries) at Triangulate.Triangulator.Triangulate(MultiPolygon multipolygon) at Triangulate.Triangulator.Triangulate(Geometry geom) at Wkb2Gltf.GeometryProcessor.GetTriangles(Geometry geometry, Int32 batchId, ShaderColors shadercolors, Point center) in /src/wkb2gltf.core/GeometryProcessor.cs:line 33 at pg2b3dm.TileWriter.GetTriangles(List1 geomrecords, Point center) in /src/wkb2gltf.core/TileWriter.cs:line 41 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 104 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 86 at pg2b3dm.Program.<>c__DisplayClass3_0.<Main>b__0(Options o) in /src/pg2b3dm/Program.cs:line 183 at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult1 result, Action`1 action) at pg2b3dm.Program.Main(String[] args) in /src/pg2b3dm/Program.cs:line 28

YXYCZXY commented 10 months ago

image Does this mean that these values cannot be empty?

bertt commented 10 months ago

Maybe the vertices don't have a z value?

YXYCZXY commented 10 months ago

Maybe the vertices don't have a z value?

Do Z values need to be processed through tesselate_building?

bertt commented 10 months ago

yes that tool will add z values

YXYCZXY commented 10 months ago

yes that tool will add z values

Thank you very much, I'll give it a try.

bertt commented 10 months ago

Btw I'm planning to add polygon support in pg2b3dm, well something for a next release

YXYCZXY commented 10 months ago

"The 'boundingVolume' in the generated tileset.json contains a region instead of a box. I was expecting a box because using this.box.clone() results in a not found error. How should I modify this? Thank you.

The data used is: bldg_footprints.shp.

The command used is:

tesselate_building -U postgres -h localhost -d datagis -t bldg -f mapbox -i geom -o geom_triangle --idcolumn id --stylecolumn style --shaderscolumn shaders

pg2b3dm -h localhost -U postgres -c geom_triangle --shaderscolumn shaders -t bldg -d datagis -g 100,0"

tileset.json: { "geometricError": 100.0, "root": { "transform": [ 0.9682309627532959, 0.2500576674938202, 0.0, 0.0, -0.15790829062461853, 0.6114256978034973, 0.7753861546516418, 0.0, 0.193891242146492, -0.7507528066635132, 0.6314874887466431, 0.0, 1238318.875, -4794808.5, 4006101.5, 1.0 ], "geometricError": 100.0, "refine": "ADD", "boundingVolume": { "region": [ -1.319322081929964, 0.6822386041030266, -1.3167909422503494, 0.684701563088823, 0.0, 76.58 ] }, "content": { "uri": "content/{level}{x}{y}.glb" }, "implicitTiling": { "availableLevels": 5, "subdivisionScheme": "QUADTREE", "subtreeLevels": 3, "subtrees": { "uri": "subtrees/{level}{x}{y}.subtree" } } }, "asset": { "generator": "pg2b3dm 2.0.1.0", "version": "1.1" } }

bertt commented 10 months ago

region is always generated, where do you get this error ("using this.box.clone() results in a not found error")?

YXYCZXY commented 10 months ago

region is always generated, where do you get this error ("using this.box.clone() results in a not found error")?

image

bertt commented 10 months ago

ah you are using MapBox, this is not supported at the moment. You have to use Cesium or an old version of pg2b3dm (<1.0). Or wait until MapBox v3 with 3D Tiles is working

YXYCZXY commented 10 months ago

啊,你使用的是MapBox,目前不支持。您必须使用 Cesium 或旧版本的 pg2b3dm (<1.0)。或者等到带有 3D Tiles 的 MapBox v3 开始工作

I understand, thank you very much