Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLTF and WGS84 or ECEF #16

Closed
stirringhalo opened this issue Sep 27, 2016 · 6 comments
Closed

GLTF and WGS84 or ECEF #16

stirringhalo opened this issue Sep 27, 2016 · 6 comments

Comments

@stirringhalo
Copy link

Quick question, I have 3DCityDB exports working nicely now, and I've tested imports in EPSG:3857 and EPSG:4326. I'm doing large scale imports from OSM (eg, state-wide and larger) so I'm looking to use EPSG:4326 for accuracy. EPSG:3857 works for KML+GLTF exports but of course is distorted in Cesium.

I've done KML extracts in EPSG:4326 which look okay, but are very slow to render in-browser. Unfortunately exports in the GLTF format don't show up. Is there a fundamental reason why GLTF doesn't show up? I realize it may have to do with showing the vertices in degrees, but I didn't think this was a limitation of GLTF.

@stirringhalo
Copy link
Author

stirringhalo commented Sep 29, 2016

In digging deeper into the spec, I've discovered I was mistaken and that units in meters are required by spec. I assume the requirement is that the X,Y,Z coords are relative to ground, so not ECEF.

https://github.com/KhronosGroup/glTF/blob/master/specification/README.md

I'm wondering if there's an easy way around this, my probably naive thinking is as follows:

1. Import in EPSG:4326 (and tagging it as such in the DB postgis srid)
2. Populate a column of cityobject table with the center (or use the center of the envelope for speed)
3. When an export occurs (to gltf files or through WFS), convert the lat+long+z to meters from pre-calculated center, and write to gltf. Add in the CESIUM_RTC extension and define the center to be the one previously calculated.

Edit: Naive thinking was wrong

@stirringhalo
Copy link
Author

Actually, can't populate a column as the RTC would be different depending on tile size and is the center of multiple objects. So modified:

  1. Import in EPSG:4326 (and tagging it as such in the DB postgis srid)
  2. When an export occurs (to gltf files or through WFS), calculate the center of the tile and add in the CESIUM_RTC extension with that tile center (in degrees). Vertices would then become the x,y,z components of the line connecting the center to the tile to the vertice.

@stirringhalo stirringhalo changed the title GLTF and WGS84 GLTF and WGS84 or ECEF Oct 5, 2016
@stirringhalo
Copy link
Author

I've asked on https://groups.google.com/forum/#!topic/cesium-dev/t6VgLN5wtVI and was told GLTF supports ECEF coordinates, which would probably satisfy the need of low distortion for placing GLTF models.

I did an import with ECEF coordinates instead of EPSG:4326, it didn't help and the tile was still missing (but the extent was calculated correctly)

Is there something missing/or an assumption in the 3dwebmap client that prevents the use of ECEF coordinates?

Sorry for all the questions, this is unfortunately a major roadblock issue for me

@yaozhihang
Copy link
Member

Hi,

the KML/COLLADA/glTF-Exporter has been implemented based on the assumption that the imported CityGML datasets shall use a projected or a 3D compound spatial reference system, because according to the best of our knowledge, none of the existing official CityGML data employed by the cities or mapping agencies worldwide are using the geographic coordinate reference system (e.g., EPSG: 4326). Thus, if you import a CityGML dataset with EPSG:4326 into the 3DCityDB. the KML/COLLADA/glTF-Exporter may sometimes produce unexpected results when exporting KML/COLLADA/glTF models.

Besides, according to the glTF spec, the exported glTF model vertices are defined in a local space which is a 3D cartesian coordinate system. Here, we simply use the KML <Model> element to store the location (lat, lon, alt) and orientation of the reference point in world space for each building object, instead of using the CESIUM_RTC extension. The 3dcitydb-web-map is able to parse the KML<Model> element to retrieve the ECEF coordinates of each building object and place it on the Cesium Virtual GLobe.

So, the only solution that i can see is to use a coordinate transformation tool like FME to convert your CityGML data onto another proper projected SRS (e.g. Gauss–Krüger System), and perform the workflow (3DCityDB-setup ->CityGML-import -> glTF-export ->visualization again.

@FxKu FxKu added this to the v4.0 milestone Feb 6, 2018
@FxKu
Copy link
Member

FxKu commented Sep 18, 2018

As of today, a new release of the Importer/Exporter is available. The glTF export has been updated as well, so maybe results are looking better now.

@FxKu
Copy link
Member

FxKu commented Oct 20, 2018

Closing this issue now. Feel free to reopen if you got any news related to WGS84 and glTF.

@FxKu FxKu closed this as completed Oct 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants