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

get geoid as javascript function #720

Merged
merged 13 commits into from
Jul 29, 2024
Merged

get geoid as javascript function #720

merged 13 commits into from
Jul 29, 2024

Conversation

kfarr
Copy link
Collaborator

@kfarr kfarr commented Jul 19, 2024

Good news -- we now have what appears to be a working method to reliably find the ground point of google 3d tiles for a 3DStreet scene.

However, how can we offer this updated feature without breaking existing user's geospatial scenes?

How we store elevation today:

  • "elevation" value is stored in street-geo component
  • this value is fetched from google elevation service which returns topographical elevation
  • street-geo adds an arbitrary hack constant (32.49158) to convert topographical height to ellipsoidal height. Using a constant value is incorrect (outside of the SF Bay Area). Instead, ellipsoidalHeight value can be calculated only with geoid height which varies based on user-specified lat/lon.

change:

  • now we have the a more accurate ellipsoidalHeight from our new cloud function (yay!), but how should we handle this new feature without breaking old stored user values?

proposed way to handle to be backwards compatible:

  • add new property to street-geo component ellipsoidalHeight
  • if ellipsoidalHeight exists, then use that value for google3d tiles without the hack constant
  • if it doesn't, then use old school elevation value with the existing hack constant

how to do this?

  • add 2 conditional statements in street-geo init and update methods:
    // if data.ellipsoidalHeight, use it, otherwise use data.elevation less constant (deprecated)
    const height = data.ellipsoidalHeight
      ? data.ellipsoidalHeight
      : data.elevation - this.elevationHeightConstant;

test scenarios:

  • user makes a new geospatial scene which automatically specifies ellipsoidalHeight for new locations; elevation may be null, NaN, 0, we don't care; correct ground location should "just work" with max adjustment of ~2 meters needed
  • user opens a existing geospatial scene -- the elevation value is technically incorrect but the user has manually adjusted their scene to match the naive constant method; what do we want to happen? we want existing behavior
  • what happens when a user edits the location of an existing geospatial scene? we want it to use the new, correct value.
  • what happens if opens an old geospatial scene, makes edits but NOT to the geospatial settings? the user expects the 3dtiles "to stay where they are" so let's make sure they do!
  • what happens if an ellipsoidalHeight value is actually 0 -- will javascript assume that the value is falsy and use the incorrect (or nonexistent) elevation value?

other issues need to fix:

  • does not allow for negative numbers for ellipsoidal value

@kfarr kfarr marked this pull request as ready for review July 21, 2024 02:55
@kfarr kfarr linked an issue Jul 21, 2024 that may be closed by this pull request
requires `GOOGLE_MAPS_ELEVATION_API_KEY` secret available to function invoker
to-do:
- save other elevations to json
- consider backwards compatibility
needs testing -- especially opening "old" files with elevation value; what happens when save without edit // save with geo edit;
@kfarr kfarr requested a review from vincentfretin July 24, 2024 03:35
@kfarr
Copy link
Collaborator Author

kfarr commented Jul 24, 2024

although this worked in local emulator, fun new error from firebase when trying to deploy:
Error: [getGeoidHeight(us-central1)] Changing from an HTTPS function to a callable function is not allowed. Please delete your function and create a new one instead.

  • does this mean i should rename it, or "delete" from a gui?

answer: delete from gui and then deploy

hopefully makes things clearer and literal to which type of elevation is being used
@rahulkgupta
Copy link
Collaborator

I'm having trouble following the description. For user's stored values, can't we just use that and not rely on the service?

"elevation" value is stored in street-geo component
this value is fetched from google elevation service which returns topographical elevation

What does this mean? Is the value stored in the scene data in the firebase db or is it fetched via google elevation?

@kfarr kfarr merged commit 2927094 into main Jul 29, 2024
1 check passed
@kfarr kfarr deleted the get-geoid-cloud-function branch July 29, 2024 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

setting elevation incorrect outside of west coast north america
3 participants