missing Transport CityObject #141
-
Hi. I might not be asking this question in the right place. ---and its possibly an issue with my clunky code. Some CityObjects are not being created. Notice the gaps in the terrain where the Transport CityObject (black road) should be. The process is -> after some basic vector manipulation -> triangulate each section of road -> save these and pop them in as CityJSON Objects. The key variables here are idxALL (the road segments), t_list (the triangulation) and rd_pts (the vertices). Which are added as such -> here: def add_rd_v(pts, cm):
#cm['vertices'] = pts
for p in pts:
cm['vertices'].append([p[0], p[1], p[2]])
#print(cm['vertices'])
def add_rd_b(T, r, acoi, allsurfaces, cm):
for i in T:
#allsurfaces.append([[i[0], i[1], i[2]]])
allsurfaces.append([[i[0]+len(cm['vertices'])-len(r)-len(acoi),
i[1]+len(cm['vertices'])-len(r)-len(acoi),
i[2]+len(cm['vertices'])-len(r)-len(acoi)]]) I know the triangulation is there. If I execute import pyvista as pv
number = 6
l2 = np.vstack(idxAll[number])
l2 = l2.reshape([-1, 2])
twos2 = np.array([[2]] * len(idxAll[number]))
linesR = np.append(twos2, l2, axis=1)
trinR = pv.PolyData(rd_pts[number])
polygonR = pv.PolyData(rd_pts[number])
holes = pv.PolyData()
# Make sure it has the same points as the mesh being triangulated
trin.points = t_list[number]
holesR = hs2[['x', 'y', 'ground_height']].values
facesR = np.insert(t_list[number], 0, np.full((1, len(t_list[number])), 3), axis=1)
trinR.faces = facesR
polygonR.lines = linesR
p = pv.Plotter(window_size=[750, 450], notebook=False)#, off_screen=True)
p.add_mesh(trinR, color="blue", show_edges=True, opacity=0.2)
p.add_mesh(polygonR, color="black", opacity=0.3, render_points_as_spheres=False)
p.add_mesh(holesR, color="red")
p.set_background('white')
p.show() where number is the position in t_list; I can see the constrained Delaunay within each road segment (I choose to include the aoi to prevent the convex hull, of the road segments, crossing adjacent terrain). Not all of t_list is being added as Transport CityObjects. Some are there and some are not. Let me know if I am asking a bit much and need to give you time. Also if I am over-complicating this and there is an better method; your advice is welcome.* |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Hi @AdrianKriger, Not sure if this is the best place either, but it's fine at the end of the day. Have you first checked if the aforementioned objects are in the CityJSON file at all by inspecting its content? It might as well be an issue with ninja not being able to visualise these geometries. Would it be possible to share the specific file shown in the screenshot so that we can check? |
Beta Was this translation helpful? Give feedback.
-
SuperSpeedy customer service @liberostelios thank you -> here. |
Beta Was this translation helpful? Give feedback.
-
I don't see the objects in the CityJSON at all. Do you happen to have an easy way of running this script with the given input data? I guess some debugging is needed here. |
Beta Was this translation helpful? Give feedback.
I don't see the objects in the CityJSON at all. Do you happen to have an easy way of running this script with the given input data? I guess some debugging is needed here.