You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

orbitlab

Trainee

  • "orbitlab" started this thread

Posts: 53

Location: Greece

  • Send private message

1

Sunday, March 6th 2011, 8:29pm

krpano as a Gis viewer

So the following gigapixel image was created from a large Geotiff image. I 'd like to write a plugin in order to display the world coordinates in the player. In order to achieve it i must know the current bounding box. The following equation finds the X and Y coordinate.

xt = Box.Xmin+(mouse.X)*pixelSize;
yt = Box.Ymin+(canvas.height - mouse.Y)*pixelSize;

Assume that i know the pixelSize of the image is it bossible to read the current bounding box in pixels?
This could open new potetionals to krpano player

Gigapixel orthoimages of Acropolis

Zephyr

Professional

Posts: 994

Location: Netherlands

Occupation: Web developer

  • Send private message

2

Wednesday, March 9th 2011, 11:38am

I'd like to help, but I don't even know what a Gisviewer is. But if it's just flash, you can know the bounding box by either stage.stageHeight / stage.stageWidth or box.height box.width
3d childrens game using krpano Game
Minify your xml with my krpano XML Compressor
Krpano XML Parsing Error Checklist
Available for hire (krpano xml, javascript, actionscript, flash, php and ipad plugins).

3

Thursday, March 10th 2011, 2:59pm

Hi,

GIS = Geographic information system

about the request - here an example code for a how to calculate the current viewed bounding box for a flat pano:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<events onviewchange="calcboundingbox();" />
    
<action name="calcboundingbox">
    set(sx,0);
    set(sy,0);
    screentosphere(sx,sy,x1,y1);
    copy(sx,stagewidth);
    copy(sy,stageheight);
    screentosphere(sx,sy,x2,y2);
    sub(i,image.level.count,1);
    copy(imagewidth, image.level[get(i)].tiledimagewidth);
    copy(imageheight, image.level[get(i)].tiledimageheight);
    mul(halfhfov, image.hfov,0.5);
    mul(halfvfov, image.vfov,0.5);
    add(x1,halfhfov);
    add(y1,halfvfov);
    add(x2,halfhfov);
    add(y2,halfvfov);
    div(x1,image.hfov);
    div(y1,image.vfov);
    div(x2,image.hfov);
    div(y2,image.vfov);
    mul(x1,imagewidth);
    mul(y1,imageheight);
    mul(x2,imagewidth);
    mul(y2,imageheight);
    if(x1 LT 0, set(x1,0));
    if(y1 LT 0, set(y1,0));
    if(x2 GE imagewidth, sub(x2,imagewidth,1));
    if(y2 GE imageheight, sub(y2,imageheight,1));
    roundval(x1);
    roundval(y1);
    roundval(x2);
    roundval(y2);
    trace('viewed bounding box =',x1,'/',y1,' - ',x2,'/',y2);
</action>


best regards,
Klaus

orbitlab

Trainee

  • "orbitlab" started this thread

Posts: 53

Location: Greece

  • Send private message

4

Thursday, March 10th 2011, 6:42pm

Ouaou i am really excited. I 'll give a try right a way.

orbitlab

Trainee

  • "orbitlab" started this thread

Posts: 53

Location: Greece

  • Send private message

5

Thursday, March 10th 2011, 7:14pm

So i get only 0 and 1 for the x y values
INFO: viewed bounding box =0/0 - -1/0

Any suggestions?

6

Friday, March 11th 2011, 8:43am

Hi,

do you use the current version? (1.0.8.12)
in your link you use the much older 1.0.8 beta 9 version, there this code doesn't work,

best regards,
Klaus

orbitlab

Trainee

  • "orbitlab" started this thread

Posts: 53

Location: Greece

  • Send private message

7

Friday, March 11th 2011, 9:51am

Oh it worked now i am preparing for the sample. Thanks klaus you are the best.

orbitlab

Trainee

  • "orbitlab" started this thread

Posts: 53

Location: Greece

  • Send private message

8

Saturday, March 12th 2011, 5:26pm

ok see for yourself Gigapixel images from acropolis . Krpano viewer became a simple gis viewer.
Click on the image to see the X Y coordinates in EGSA 87 (greek grid) projection system.
Maybe the next step would be the digitization using you editor.

Thanks Klaus