Attached is a simple c++ program to get the bucket (tile id).  It links
with SimGear so it is always right...  SimGear handles loading the
scenery, so even if its wrong its right :0

On Sat, 2006-03-11 at 10:45 +1300, dene maxwell wrote:
> Hi Melchior,
> 
> Thank you for the formula. I wrote a wrapper for it so that I can enter 
> lat/long and get a tile ID. I have tested it for scenery that I have but 
> given the numebr of conditional branches I don't feel confident that it is 
> bullet proof. I found one difference in interpretation mathematical order 
> when testing with KSFO!
> 
> I am requesting assistance for testing the rest of it for scenery I don't 
> have;
> 
> NZWN  S41* 19' 38"    E174* 48' 19"   ->      e175s41/5803051.stg     Checked 
> OK
> YSSY  S33* 56.8'      E151* 10.6'     ->      e151s34/5426688.stg     Checked 
> OK
> KSFO  N37* 37' 8.3"   W122* 22' 29.6" ->      w123n38/942049.stg      Checked 
> OK
> 
> Quadrants not checked
> S/W   Mexico/South America
> N/E   Central and Eastern Europe/China/Japan
> 
> Could people that have access to either world scenery or the areas detailed 
> below check that a reference to the airport identifier appears in the text 
> descriptor file listed.
> 
> S/W
> SBGL  Rio de Janerio  S22* 48' 34"    W43* 15' 00"    ->      
> w043s23/2232523.stg
> SBSP  San Paulo       S23* 37' 32"    W46* 39' 21"    ->      
> w047s24/2183313.stg
> 
> N/E
> Paris Charles de Gaulle       N49* 0' 35"     E2* 32' 52"     ->      
> e049n03/3757856.stg
> 
> 
> alternatively if you have the lat/long of an airport and you know the tile 
> it appears in. The lat/long and tile ID would be appreciated.
> 
> TIA
> Dene
> 
> 
> >From: Melchior FRANZ <[EMAIL PROTECTED]>
> >
> >* Thomas Frster -- Thursday 09 March 2006 20:32:
> > > Maybe there are scripts around (Melchior?) that also calculate tile id 
> >for
> > > given lat/lon.
> >
> >   scripts/perl/scenery/calc-tile.pl
> >   http://members.aon.at/mfranz/flightgear/calctile.nas
> >
> >m.
> >

//g++ test.cpp -lsgbucket -lsgmisc -lsgprops -lsgstructure -lsgxml -lz -lsgdebug -oTest


#include <simgear/compiler.h>
#include <simgear/bucket/newbucket.hxx>
#include <simgear/misc/sg_path.hxx>

#include <iostream>

#include SG_GLUT_H

#include <plib/ssg.h>

using std::cout;
using std::cerr;
using std::endl;

/*
#include <iostream>
#include <stdio.h>
*/

int main(int argc, char *argv[])
{
	double dlong=-111.89195, dlat=40.77037;

	if(argc!=3)
	{
		cerr<<"Usage:\n"<<argv[0]<<" longitude latitude\n";
		exit(1);
	}

	dlong=strtod(argv[1], NULL);
	dlat=strtod(argv[2], NULL);

	SGBucket myBucket;
	myBucket.set_bucket( dlong, dlat);

//cout<<myBucket<<'\n';

	cout<<myBucket.gen_base_path()<<"/"<<myBucket.gen_index()<<".stg\n";

}

Reply via email to