Haris Hussain
Haris Hussain

Reputation: 2581

How to Plot (show) user location on Image? iOS

So here is task i need to get done on iOS:

Show User's Current Location on an Image like this:

enter image description here

Yes, like this Image!

So few things one will notice as soon as one look at it. Its Tilted. It's headings are Off. You can see horizon..!

Lets say,

But thats the task, i need to show users location on such images. Just like in "Google Earth".

Can anyone give me heads up to accomplish this task?

Thank you everyone. :)

Upvotes: 13

Views: 434

Answers (2)

Haris Hussain
Haris Hussain

Reputation: 2581

I achieved the desired result by plotting the coordinate on a UIView and transform it using CATrasnform3D. These explanations also help, Explanation of Transformation Matrix in terms of Core Animation and Core Animation Programming Guide itself.

_graphic.transform = CGAffineTransformMakeRotation(-2.89724656);

CATransform3D rotatedTransform = _graphic.layer.transform;

rotatedTransform.m34 = 1.0 / 500;
rotatedTransform.m22 = -2;
rotatedTransform.m41 = 170;
rotatedTransform.m42 = 170;

rotatedTransform = 
CATransform3DRotate(rotatedTransform, 
                    51 * M_PI / 180.0f, 
                    1.0f, 
                    0.0f, 
                    0.0f);


_graphic.layer.transform = rotatedTransform;

[_graphic setNeedsDisplay];

Thank you all.

Upvotes: 0

bertobot
bertobot

Reputation: 116

Given the information you have, sounds like you can use line-plane intersection to solve your problem.

Upvotes: 1

Related Questions