3D Tiles not flush with the ground (Resolved)

I’m trying to convert ESRI shapefiles to Cesium 3D Tiles in Python. I’m using a Python library called py3dtiles which does a good job of getting my geometry on the map, but there’s an issue where the geometry is at a seemingly 45 degree angle to the ground, so that half of the polygons are floating above the earth at an angle and half are underground.

Here’s a screenshot that shows what that looks like. My 3D Tile in question are the blue polygons. The red polygons are a 3D Tile created by a paid software, which I include to show what it should actually look like.

I feel like I’m missing some key ingredient or last step to get the angle of my 3D tile right. I’m happy to give as many details as needed. My Python script is on Github as is my resulting 3D tile: GitHub - PermafrostDiscoveryGateway/viz-3dtiles: PDG vizualization pipeline for 3D Tile processing

UPDATE: I have resolved my issue and will put my solution here in case this helps anyone else. My issue started with the fact that I am converting 2D geometry with only x,y values to 3D geometry with x,y,z values. I wanted the 3D models to have a height of 0, so I was inserting a z value of ~ 6169085 into each point on each polygon to get my polygons to show up on the Cesium map. The correct way to do this is to insert a z value of 0 before I transform my geometry to ECEF coordinates (e.g. EPSG 4326) and then transform my coordinates to EPSG 4978 (required by Cesium 3d Models). Those 0 z-values will then be correctly transformed to the correct z coordinate value.

Hi @lauren_walker. Thank you for your question! I am happy to see that you were able to resolve your issue. In addition, I am grateful that you posted the solution for the rest of the community to use.