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

Converting Lat/Long to meters producing incorrect values #4

Closed
kmay30 opened this issue Jan 27, 2018 · 6 comments
Closed

Converting Lat/Long to meters producing incorrect values #4

kmay30 opened this issue Jan 27, 2018 · 6 comments

Comments

@kmay30
Copy link

kmay30 commented Jan 27, 2018

Hello,

I've been attempting to get appropriate output out of the "example/3d-position" branch, and in particular, WGSConversion.cs.

I am expecting to be able to feed in lat and long of a known position relative to the unity scene, which the origin of the unity scene, and have IndoorAtlas lat and long values converted into meter-scale deviation from that center point.

However, I am getting enormous values- orders of magnitude larger than what one would expect.

It's possible I am doing something incorrectly, but this could also be an issue with the code.

@simomar
Copy link
Contributor

simomar commented Jan 29, 2018

Hello @kmay30.

The way you should be using the conversion class is to first set a fixed point ("origin") to your 3D scene with setOrigin method, for example:

IndoorAtlas.WGSConversion temp = new IndoorAtlas.WGSConversion ();
temp.setOrigin (63.357219, 27.403592);

Then you can compute relative (east, north) transitions with WGStoEN method, for example:

Vector2 eastNorth = temp.WGStoEN (63.357860, 27.402245);
Debug.Log ("East-North transition: " + eastNorth.x + ", " + eastNorth.y);

This gives me a transition of (-67.42091, 71.45055) from origin, that is, a transition of ~67 meters to West and ~71 meters to North from origin.

This makes sense to me: The origin (in this example) is at the beginning line of a 100 meters track and the end is at the finish line. The length of the transition vector is 98.2 meters.

I hope this helps.

@kmay30
Copy link
Author

kmay30 commented Jan 31, 2018

This was helpful and things are now functioning as expected, thanks!

@simomar
Copy link
Contributor

simomar commented Feb 7, 2018

I'm glad to hear that the comment above helped you to solve your problems. I merged the changes to master branch and, based on this discussion, added a numerical example to README.md file.

@simomar simomar closed this as completed Feb 7, 2018
@kansaraurmil55
Copy link

There is a question related to this issue, how to know the origin coordinates once we do a setOrigin() on the indoor atlas with respect to our coordinates. The reason behind asking this question is, I need to place my camera facing north and also want it to be at the origin.

@kmay30
Copy link
Author

kmay30 commented Apr 2, 2018 via email

@simomar
Copy link
Contributor

simomar commented Apr 3, 2018

That is correct.
IndoorAtlas Unity plugin is unaware of your 3D environment / map so we decided to implement a coordinate transformation utility, which maps (latitude, longitude) coordinates to metric (east, north) coordinates. These coordinates can be used further to find the location in (Unity's) 3D space.

The origin can be (theoretically) any point in the world but algorithm's approximation error increases when you compute metric transformations far away from the origin. In many applications it makes sense to set the origin as a "landmark point" whose GPS coordinates can be determined accurately (e.g. from map). This makes it easier to place 3D environments to physically correct places.

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

No branches or pull requests

3 participants