On Monday 13 December 2010 16:15:47 Jacob Burbach wrote:
> I wonder if someone could give me a hand with this to make sure I do
> it correctly. I'm trying to decode the coordinates of a given scenery
> tile so I can create a kml file for visualization purposes. Based off
> the btg importer on the wiki and the calc-tile.pl script I've put
> together this bit of code here.
>
> http://pastebin.com/gG6BfdWu
>
> I believe it does the correct things, it matches what the exporter
> spits out anyway. Could anyone confirm if this is indeed properly
> decoding the tile coords?
>
> Also about the x and  y values, it's the position of the tile in a
> grid that makes up the region? Where is the origin of the grid then, I
> assume the lower left / south west...x increasing longitude and y
> increasing latitude or? And lastly what is correct way to get the
> coordinates of each corner of a tile...should I just add or subtract
> half span from the center coordinates like so
>
> min_lat = center_lat - (span * 0.5)
> min_lon = center_lon - (span * 0.5)
> max_lat = center_lat + (span * 0.5)
> max_lon = center_lon + (span * 0.5)
>
> or...?
>
> thanks
> --Jacob

The attached cpp file takes latitude and longitude and spits out a tile 
number.  You could use it to test your python code.

>fgbucket latitude longitude

>fgbucket 44.41 44.41
e040n40/e044n44/3678617.stg

Good luck,
Ron

P.s.
I've noticed a trend to use pastebin.ca here.  Small code attachments and such 
are preferred here to pastebin because it keeps the history together.  
Thanks.
//g++ fgbucket.cpp -lsgbucket -lsgmisc -lsgprops -lsgstructure -lsgxml -lz -lsgdebug  -lsgtiming -losg -losgDB -ofgbucket

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

#include <iostream>

#include <GL/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]<<" latitude longitude\n";
		exit(1);
	}

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

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

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

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

}
------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to