viewer-flat-x3dom - Provide a X3D geospatial solution (3D tile and viewer)
If you want to use the geospatial component, you could replace the Polyline2D with Lineset and GeoCoordinates. The Transform is then not needed.
It is more tricky to replace the Extrusion node since there is no equivalent GeoExtrusion available. You would have to use IndexedFaceSet. The GeoCoordinates would list the footprint coordinates at ground level and at roof level. Then you need to construct the indices defining the polygons (quads would be easier than triangles). This is easier than it may sound.