VCityTeam / py3dtilers

Tilers accepting various input formats (OBJ, 3DCity databases, GeoJson, IFC) and producing 3DTiles tilesets.
GNU Lesser General Public License v2.1
198 stars 52 forks source link

Questions about GeojsonTiler generating b3dm models #154

Open lky00 opened 1 year ago

lky00 commented 1 year ago

Hello, I am very sorry to trouble you as a novice, I used the command to generate the model, and then used cesium to load 3DTiles, and found that the generated model surface does not show only one border, my geojson content and command are as follows:

geojson-tiler -i e://json/9.geojson --height 1 --output_dir E:\geojson1\ --crs_in EPSG:4978 --crs_out EPSG:4978

{ "type": "FeatureCollection", "features": [ { "geometry": { "coordinates": [ [ [ -705954.297507661, 5349600.36960837, 3391996.59135124 ], [ -705939.260345355, 5349595.04885524, 3392013.05057815 ], [ -705963.844254904, 5349605.34456638, 3392018.88245269 ], [ -705954.297507661, 5349600.36960837, 3391996.59135124 ] ] ], "type": "Polygon" }, "type": "Feature", "properties": { "ID": "b652ebd0-203e-4e65-aa4d-d5fed1fe7b77" } }, { "geometry": { "coordinates": [ [ [ -705973.182971921, 5349608.65657394, 3392008.64281767 ], [ -705954.297507661, 5349600.36960837, 3391996.59135124 ], [ -705963.844254904, 5349605.34456638, 3392018.88245269 ], [ -705973.182971921, 5349608.65657394, 3392008.64281767 ] ] ], "type": "Polygon" }, "type": "Feature", "properties": { "ID": "1c0f23ec-c4da-42ec-aa96-a6cffbda91cf" } }, { "geometry": { "coordinates": [ [ [ -705954.297507661, 5349600.36960837, 3391996.59135124 ], [ -705938.58636745, 5349594.65822696, 3391977.68118752 ], [ -705939.260345355, 5349595.04885524, 3392013.05057815 ], [ -705954.297507661, 5349600.36960837, 3391996.59135124 ] ] ], "type": "Polygon" }, "type": "Feature", "properties": { "ID": "397a9a0a-ee28-40d2-a2cd-ba240cae382e" } } ] }

1

Flip it to the back and it will show

2

Thank you for your advice

LorenzoMarnat commented 1 year ago

Hello,

Are you sure your GeoJSON polygons are correct? When I try to visualize the file in QGIS, I have only a white screen:

image

When using EPSG:4326, all I get is this weird shape:

image

And if I try to export the layer in a new geojson file, I get "null" geometries:

image

lky00 commented 1 year ago

First of all, thank you very much for your answer. Sorry, I have provided the wrong part of generating b3dm from geojson file. The complete geojson file is relatively large, and this is the model I generated through commands. Most of the GeoJSON files are normal, but some parts are hollowed-out, and the colors are not displayed.

The generated complete model: Snipaste_2023-09-05_17-26-32

Partial hollowing: Snipaste_2023-09-05_17-28-08

Flip to the back: Snipaste_2023-09-05_17-29-05

LorenzoMarnat commented 1 year ago

Actually, I don't know why some normals are in the wrong direction. The GeoJSON Tiler is supposed to check the coordinates before triangulation to ensure the normals will be correctly oriented. If you identify a small GeoJSON part that has this problem, I'd be interested in doing some tests with it.

If you visualize your 3DTiles with Cesium, you can try using the new --no_normals option (PR #159). This option creates 3DTiles without normals, so Cesium can handle them. Hope it would help

geojson-tiler -i data.geojson --no_normals