How to instantiate an object at GPS coordinate?

Hi folks,

I would like to instantiate an object at some given coordinate. For example, I have GPS coordinates of my house and I would like to place an object at that location, then i would like to know if I’m near the object (unity renders the object close to the camera) or far (renders the object away to the camera - or invisible).

How can i do that?

(I’m also using vuforia for AR Camera)

Convert the GPS coordinates into X/Z values (you can set the Y value based on the get terrain height at X/Z). Basically 1° degree Latitude/Longitude at the equator is approximately 111 Kilometers (111,000 meters). The math to convert Degrees° Minutes’ Seconds" values to decimal meters is rather straight forward. Take a look at these links…

The problem you’ll encounter is that GPS coordinates are spherical, that is, the farther North/South you get away from the equator the smaller the distances for X are (as they converge to a single point at the poles). The question you have to ask yourself is how BIG is the area you are working with? If a small area, then you really don’t have to factor this compression in. If you are doing something that covers the whole globe then you’ll have to do the math (remembering to factor in the diameter of your world).

Once you have the X/Y/Z values calculated the instantiation call is rather simple. Please let me know if you need assistance with that (your initial post was a little vague on what you were really asking for help with).

I’m also struggling with this. I managed already to get x and z coordinates from a gps coordinate, but i think they are wrong because the don’t regard the initial device rotation, or in other words, i think i’m getting the absolute value of the gps location, but if a place is like 10 meters away from my current place, i don’t know if it’s in the positive or in the negative side of the axis. @DiGiaCom-Tech can you help me with this?