Skip to content
This repository has been archived by the owner on Aug 14, 2022. It is now read-only.

Projection is almost ECEF but on a pure sphere not an ellipsoid in usual GIS systems? #36

Open
ecopirate opened this issue Sep 3, 2019 · 7 comments

Comments

@ecopirate
Copy link

ecopirate commented Sep 3, 2019

It looks like that the mesh is on an ECEF coordinate system, but on a pure sphere not an ellipsoid in usual GIS systems.

Originally posted by @LexSong in #4 (comment)

Greetings LexSong

Following your insight into the use of ECEF projection I tried firing-up BlueMarble Geographic Calculator and started experimenting. My workflow is to:

  1. Copy out the object file's "v: X Y Z" coordinates into a plain CSV file using Notepad++.
  2. In BlueMarble set source projection as "Geocentric WGS 84"
  3. Set output projection as "Geodetic WGS 84"
  4. Import into ArcGIS and check the positioning.

Tried on two areas in the UK and the Bahamas.
So far area extent and Longitude positions of the results looks okay
HOWEVER Latitude in both test cases is about 20 km off in a Northerly direction.

So...really great if you could please explain a little bit more what you mean when you say the exact ECEF projection used is "a pure sphere not an ellipsoid in usual GIS systems."?
And any suggestion on

how to handle that??

Thanks!

Ian

Example showing projection error for the Bahama test:
Bahama_16km_error

@LexSong
Copy link
Contributor

LexSong commented Sep 4, 2019

What I mean it's that you shouldn't use projections like WGS84. Just calculate latitudes and longitudes directly from XYZ, assume that the Google earth is a perfect sphere.

@LexSong
Copy link
Contributor

LexSong commented Sep 4, 2019

The formula is:

R = sqrt (x^2+y^2+z^2)
Latitude = arcsin(z/R)

@ecopirate
Copy link
Author

Thanks Lex Song,

Assuming Radius of Earth is exactly: 6,371 km (6371000 meters)

The full formulae would then be :
R = sqrt (x^2+y^2+z^2)    
Latitude = arcsin(z/R)  
Longitude = arctan(y/x)
Height = R - 6371000

Quick Google Sheets calculator based on the above here:
https://docs.google.com/spreadsheets/d/1CVc_ldL6gmUG51IYMtCQbr88_Yo9Y1458bw1CAglfgA/edit?usp=sharing

Cheers,

ian

@LexSong
Copy link
Contributor

LexSong commented Sep 5, 2019

Height = R - 6371000

Well, it's way more complicated than that. I'm not sure about how Google did choose their height reference. I can't even get a good estimation from the low-resolution mesh of the whole globe. In some places, I think the sea level may even have several Kms differences. The height is not as useful as latitude and longitude here.

@ecopirate
Copy link
Author

ecopirate commented Sep 5, 2019

Yep, I also haven't find been able to find much detail on how Google chose there spatial references.
But quite happy here with the results of replacing the lines calculating vertices x,y,x points in dump_obj.js with the following:

EDITED
let pi = Math.PI;
let R = 0;

	R = Math.sqrt((_x * _x) + (_y * _y) + (_z * _z)); 
            x = 180.0 / pi * Math.atan2(_y ,_x);
	y = 180.0 / pi * Math.asin(_z / R);
	
	z = R - 6371010;

@retroplasma
Copy link
Owner

retroplasma commented Sep 7, 2019

They use 6371010 for the radius.

@desmondCTNG
Copy link

desmondCTNG commented May 31, 2020

Yep, I also haven't find been able to find much detail on how Google chose there spatial references.
But quite happy here with the results of replacing the lines calculating vertices x,y,x points in dump_obj.js with the following:

EDITED
let pi = Math.PI;
let R = 0;

	R = Math.sqrt((_x * _x) + (_y * _y) + (_z * _z)); 
            x = 180.0 / pi * Math.atan2(_y ,_x);
	y = 180.0 / pi * Math.asin(_z / R);
	
	z = R - 6371010;

Are these edits refering to line 212 to line 214 of dump_obj.js? Or also line 262 to 264 of dump_obj.js?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants