-
Notifications
You must be signed in to change notification settings - Fork 32
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
Instantiate a 3d model at a given GPS location #30
Comments
My strategy with this library is to "unreference" Google earth so that a specific point on the surface is at 0,0,0. Then, georeferencing your own model is easy. I'll make a better demo but here's one that shouldn't be too hard to understand https://drive.google.com/file/d/1WPT7yvMyoXIt6e9TqzfRqWFmtiDuGDTZ/view?usp=drivesdk With the "UltraGlobe" lib, I do the opposite transform |
Hey @ebeaufay thank you for you quick answer, Here is the detail of what I did leading to unsuccessful positioning :
Then for 3D Model instancing:
Using this strategy, the model doesn't appear in the correct position. Thanks, |
is your model georeferenced? if you open it in blender, is it centered on 0,0,0? If so, you don't need to transform the model, you only transform the google tiles. Leave your model in it's original coordinate system and transform google earth data with then if it's not perfect, you can still move your model a bit to bring it higher, a bit more to the left or whatever in local cartesian coordinates. If your model is georeferenced, the question becomes in what reference because there are thousands and ideally, you'll have to apply the transformation to every vertex rather than to the entire model. |
Thank you. My model centered on 0,0,0, not having georeferenced coordinates. |
Hmmh, I see Then compute the 2d vector in meters between the Google center point and your model desired center point. Apply that directly to the model "position". That's different from "llhToCartesian". That method computes the Cartesian coordinates for a lon lat height relative to the center of the earth. What you want is simpler. You need a method that computes the 2d vector in meters between 2 llh points. I guess ask chatGpt for one. Normally, the earth needs to be considered as an ellipsoid "wgs 84" but for small distances, you can get away with a sphere approximation I'll make a layer in UltraGlobe to handle all this automatically but the lib is still a bit young. I think you're on the right track like this |
Ok thank you I will try and post a solution here ! |
So here is the solution I used to compute the 2D vector from the Google center point to the coordinates of my model :
Then you should convert this vector to Three js coordinate system:
Note that this method is fine for distances within a few kilometers, but will give unprecise results with higher distances. For more precise calculation you can have a look at Haversine Formula. |
Hello @ebeaufay,
I've been reading your code and docs and tried to instantiate a model at a given lat/long/height on a Google 3d tile but I couldn't succeed.
Do you have hints on how I could achieve that ?
Thank you for your help,
Bioush
The text was updated successfully, but these errors were encountered: