[GIS] Using local mean sea level (LMSL) as altitude for converting latitude longitude altitude to ECEF

ecef"geoidlatitude longitude

I am new in Geographic area and would like to convert latitude and longitude coordinates into ECEF x,y coordinates so that I could do some linear calculation of line or circle equation. I was able to get the elevation of the coordinate using Google Maps Elevation API and it says that the value is local mean sea level (LMSL). Can I use this value as altitude for ECEF? Or should I also use the geoid height value from EGM2008 or combine both LMSL+geoid height as altitude?

Case in point:

Latitude = 52.394033° N = 52° 23' 38.52" N 
Longitude = 13.133462° E = 13° 8' 0.46" E 
GPS ellipsoidal height (Google elevation) = 42.27206802368164 (meters) 
Geoid height (EGM96) = 40.229 (meters) 

Which one I should use as altitude for ECEF?

Best Answer

To convert from orthometric (vertical datum-based) heights to ellipsoidal heights, you need to add the geoid height to your Google Map elevations. I am not exactly sure how Google uses LMSL, it might simply be based on a local or national vertical datum (maybe like Normalhöhennull in Germany), but seeing that your data comes from Google Maps, using the EGM2008 as your geoid would be reasonable, the deviations between local mean sea levels and the global geoid-based sea level are usually within 1-2 meters, and Google Maps elevations are not perfect anyway.

Geoid heights vs Ellipsoidal heights