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.

1

Friday, September 18th 2020, 9:43am

How to loadpano a new XML chosen by a cgi script for dynamic tours

In my efforts to add VR tours to my collection of many hundreds of panoramas, I want it so that when a user clicks "next" the panorama they go to next is decided by an external program. That's because I will have many possible tours you can take through the collection, with "best of" and subset and "360 only" or "2009" as possible tours. As such, the order of the tours will change and can't easily be stored inside the XML files for the panoramas.

At first, I think I got confused because the term "url" is used for both the arguments of openurl (which takes and http URL for the browser) and openpano. From the look of things the latter does not take a URL. Sadly, before realizing this, I made a CGI which does a redirect to the (web) URL of the xml of the panorama that is next or previous in the tour.

So if that won't work, what's the best way to do this? I have a few options I can keep in mind, hand-generating a special custom XML including the definition of variables with the tour, but I would have to do that for each user on the site. I could also generate a large stream of XML files for each tour which include the underlying base XML and only define the next/prev values for this particular tour. All pretty messy, so I hope there might be a better solution. I would have to make scripts to rebuild these tour files with every change.

If one doesn't exist, aside from the ability to invoke outside code in an XML, another option would be a function to use something like gdbm. Then you could make a dbm query for "file,tourname,next" and it would provide the XML of the next file (tourname would be a variable fed into the start of the tour and preserved so the XML files do not need to be duplicated.

Any other ideas on how best to do this?

Still interested as well in how to get 360 degree flat panos with no attempt at rectilinear distortion when zooming out, but still wrapping around and working in VR and the other issues from my prior thread, but I thought this question should get in a new thread in case somebody else searches for it.

2

Saturday, September 19th 2020, 9:28am

Thinking about this more, I came up with some possible methods.

  1. I could use the filesystem as a database, creating a giant tree of xml files of tourname/panoname.xml for every pano in every tour. Then that could get included and would contain the data on which panos are next and previous in that tour
  2. I could create one very large xml for each tour with a scene for each pano, that scene encoding the name of next and previous. For large tours this would be a bit big and a tool would be needed (as above) to build the files
  3. I could make an xml for each tour just defining an array, with both numeric and named access so from any pano you can find the next and previous elements in the array.

Which of these makes the most sense, or is there a better approach?

3

Monday, September 21st 2020, 5:28am

Follow up. I have found a reasonable solution is to declare a simple array with just the names being the designators of the panos. The documentation on arrays in krpano could be organized a bit better, I might suggest, since a lot of it is under plugins (though it seems not to relate to any plugin) and some is in other sections. Once I went through all of it I was able to work out solutions, but I must admit it would be nice to have a more comprehensive guide to writing equations and working with variables, and when you need to put get() around things and when you don't etc. Took a lot of trial and error.

Continue to puzzle on how to switch the pano projection from cylinder to flat. I tried to set( image.type, "flat" ) but it seemed to have no effect. Any other suggestions? I want to do this when people zoom out far enough that the rectilinear projection done on cylinders looks really undesireable. Sadly, for now that means giving up 360 wrap-around but I think I may be able to fake that out another way...

Now on to learning how to display text. My goal is to put text (particularly in VR) into the black region just above or below the pano (almost none of my panos are full view spheres so there is always such text.) I read somewhere that only hotspots display text in VR -- is that old news or is it still true?