geoadmin / mf-chsdi3

api3.geo.admin.ch source code
https://api3.geo.admin.ch
Other
33 stars 15 forks source link

Z-coordinate difference between Height service and embedded values in swissBUILDINGS3D 2.0 #3156

Open RobertoMinelli opened 5 years ago

RobertoMinelli commented 5 years ago

Dear all,

I am trying to create a single 3D model (.stl) that contains both a 3D surface representing a terrain and the buildings that lie on that terrain.

To generate the terrain surface, I create a XY-grid of coordinates and I obtain the elevation using the Height service of the GeoAdmin API REST services.

I obtain the buildings contained in the terrain by leveraging the swissBUILDINGS3D 2.0 dataset that I've bought.

Now, the problem: The COLLADA (.dae) models contained in the swissBUILDINGS3D 2.0 dataset have embedded XYZ coordinates (i.e., each building knows where it should be placed on the terrain). X and Y coordinates match with my terrain. Unfortunately, the Z-coordinate do not march (i.e., the terrain is always above the buildings, as per screenshot attached). Do you have any intuition? Am I doing something wrong?

screenshot_2019-04-05_at_11 20 17

cc: @danduk82 @davidoesch @oterral @procrastinatio 😇

procrastinatio commented 5 years ago

For the height service, SwissBuilding and 3D terrain tiles in map.geo.admin.ch are using the usual height (LN02). So altitude for these datasets must be consistent.

But as coordinates in the two latter are WGS84, it is possible that some tools assume that altitude is the expected WGS84 ellipsoidal height one, hence the about 50 meters discrepancy. If you intermixes between the various local (=swiss) systems (LN02, RAN95, etc.), errors will remain within a few meters margins.

RobertoMinelli commented 5 years ago

Thanks, @procrastinatio. You are right, Collada uses WGS84 🤦‍♂️

danduk82 commented 5 years ago

@RobertoMinelli is this still an issue?

RobertoMinelli commented 5 years ago

Yes, @danduk82. When I assemble a terrain obtained by triangulating 3D points obtained using the Height Service the result is always what is in the first picture. Moreover, If I move uniformly the buildings to touch the terrain, when the building with the lowest Z-coordinate touches the ground, buildings on mountains fly. Do you have any workaround for that?

danduk82 commented 5 years ago

@RobertoMinelli, you should convert your colladata altitudes to LN02.

As @procrastinatio told here above, in our data, the Z coordinate is not reprojected on the WGS84 ellipsoid, but for "consistency with the original dataset reasons" we keep the Z coordinates that we get in the original LV95 datasets. Which is in LN02...

RobertoMinelli commented 5 years ago

Grazie @danduk82. Any hint on how to read and convert Z-coordinates from COLLADA models? As of now I was only converting COLLADA to .stl in order to merge it with the terrain (obtained bu querying your Height Service.

I am just wondering then... why are the altitudes in the swissBUILDINGS3D dataset in WGS84? Because of the format, i.e., COLLADA?

Thank you very much, Rob

davidoesch commented 5 years ago

Yes. Inline/collars is wgs84

Roberto Minelli notifications@github.com schrieb am Mi. 15. Mai 2019 um 17:25:

Grazie @danduk82 https://github.com/danduk82. Any hint on how to read and convert Z-coordinates from COLLADA models? As of now I was only converting COLLADA to .stl in order to merge it with the terrain (obtained bu querying your Height Service.

I am just wondering then... why are the altitudes in the swissBUILDINGS3D dataset in WGS84? Because of the format, i.e., COLLADA?

Thank you very much, Rob

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/geoadmin/mf-chsdi3/issues/3156?email_source=notifications&email_token=ABC5TPYFO3FKO6GTVTSCHYLPVQTOLA5CNFSM4HGHBNE2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVPAVUQ#issuecomment-492702418, or mute the thread https://github.com/notifications/unsubscribe-auth/ABC5TP5M5J3WY7BRVAL3WRLPVQTOLANCNFSM4HGHBNEQ .

RobertoMinelli commented 5 years ago

Any news on this @danduk82? It would be amazing if there was a way to have a match between the two height models... Moreover, as you can see in the screenshots below, if I manually align one of the buildings to the ground, other buildings are "flying". As of now, my terrains have a resolution of 25 meters (i.e., I query the Height Service every 25 meters in a swipe fashion then I triangulate points to get the surface).

original Situation right after the import

shift-z Situation after shifting up all the buildings and aligning the one with lowest z-coordinate to the ground

flying As you can see, other buildings are flying 😢

I also attach the two .stl models of terrain and buildings.

STL_models.zip

Thanks, Roberto