You are not logged in.

## Angle of panormaic images

Monday, March 14th 2011, 10:22pm

### Angle of panormaic images

Hi,

I have a lot of panoramic images which are assigned to coordinates, do you have any suggestion/advise how can i calculate the arrow direction to enable to go the next panorama?

This post has been edited 2 times, last edit by "Gulsun" (Mar 15th 2011, 8:12am)

Professional

Posts: 1,003

Location: Netherlands

Occupation: Web developer

Tuesday, March 15th 2011, 10:14am

you need to know the y distans (long1 - long2) and the distance(lat1 - lat2) and then perform a tanges to know the angle between these points.

Alsoo this is a good site: http://www.movable-type.co.uk/scripts/latlong.html

search for bearing.

Tuesday, March 15th 2011, 10:33am

Hi,

Thanks for answer! I have also tried some ways (postgis, bearing calculation) but i dont know how can i show this result as arrow in krpano (ath/atv or rotate)?

best regards
Gülsün

Professional

Posts: 988

Location: Poland, Europe

Occupation: krpano developer : virtual tours

Tuesday, March 15th 2011, 10:50am

### plugin

Hi.

I have KRpano plugin who automatically calculates the distance between two markers.

example no javascript

The result given in kilometers in miles.

pietero

edit:

I used this formula.
ACOS(SIN(lat1)*SIN(lat2)+COS(lat1)*COS(lat2)*COS(lon2-lon1))*6371
Your own online, cloud tool for creating virtual tours - www.cms4vr.com

cms4vr team

Tuesday, March 15th 2011, 11:22am

Hi spacerywirtualne,

Your plugin is not for download or? Anyway i need a solution to show my arrow direction in krpano automatically. Is there any way to draw a line between two lat/lon(maybe it is a solution)? Or bearing is really for me a solution?

Is there nobody who really worked with lat/lon?

Professional

Posts: 1,003

Location: Netherlands

Occupation: Web developer

Tuesday, March 15th 2011, 11:42am

once you have the bearing, you can make a arrow hotspot pointing up, you then can use ath for the bearing (north being at 0)

Tuesday, March 15th 2011, 1:46pm

Hi Zephyr,

Thanks for answer! What do you exactly mean with (north being at 0)?

My Problem is;

if my way horizantal like this bearing from X to x2 => 90 and from X to x3 => 270. I see my arrow in left and right not in front of my car. (my arrow in the wrong place)

--------------------------------------------
x1 X x2
--------------------------------------------

if my way; X to X1 => 0 and X to X2 => 180. And my arrow in the right place, in front or back of my car.

| x1 |
| |
| X |
| |
| x2 |
| |

Do you have any advice? Thanks a lot!

Gülsün

My code calculating bearing in java

double y = Math.sin(dLon) * Math.cos(Double.valueOf(point2.getLat()));
double x = Math.cos(Double.valueOf(point1.getLat()))*Math.sin(Double.valueOf(point2.getLat())) -
Math.sin(Double.valueOf(point1.getLat()))*Math.cos(Double.valueOf(point2.getLat()))*Math.cos(Double.valueOf(dLon));
double brng = Math.atan2(y, x);
return (Math.toDegrees(brng));

Professional

Posts: 1,003

Location: Netherlands

Occupation: Web developer

Tuesday, March 15th 2011, 2:53pm

with north = 0, I mean that you should align your panorama so, that the center of the image is your north bearing (so in krpano ath = 0 = north)

see attachmebnt for image
Zephyr has attached the following image:

Tuesday, March 15th 2011, 4:59pm

Hi Zephyr,

Firstly thanks for answer but i cannot understand exactly, what do you mean?

I have to change my latitude and longitude for aliging to north 0? Because i tried your formula but it does not work for me. Or i have to calculate bearing of my lat/lon to north.

best regards
Gülsün

Professional

Posts: 1,003

Location: Netherlands

Occupation: Web developer

Tuesday, March 15th 2011, 8:25pm

A panorama is just an image. YOU have to say, my car is north or northwest. Else you can just put your panorama upside down and make it black :P Only then you can start putting hotspots down on base of long/lat.

Wednesday, March 16th 2011, 11:46pm

Thanks for answer :) i unterstand now :)

Wednesday, July 20th 2011, 1:47am

### Quoted from "Zephyr"

with north = 0, I mean that you should align your panorama so, that the center of the image is your north bearing (so in krpano ath = 0 = north)
Hello, I have the problem of having two panoramas wich are not align to same 'north', meaning, the ath = 0 is looking at different directions in both panos. this is a problem when going from one pano to the next, since they are no aligned to eacht other.

how can i correct this? some correction factor, so ath=0 is lookint at the real north in both panoramas.

thanks

Professional

Posts: 1,003

Location: Netherlands

Occupation: Web developer

Wednesday, July 20th 2011, 11:19am

Best way is photoshop. But krpano provides a parameter to adjust the rotation:
http://krpano.com/docu/xml/#image.prealign