Getting the position of a loaded geo tiff

classic Classic list List threaded Threaded
3 messages Options
GameCodingNinja GameCodingNinja
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Getting the position of a loaded geo tiff

Say for example I loaded a geo tiff of Boston in an image layer and I want to get the position of this so that I can rotate osgEarth to center on this location. How would I get the position information?
Tension Tension
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Getting the position of a loaded geo tiff

If I understood you correctly, you can get center point of any layer like this:

DataExtentList dataExtents = layer->getTileSource()->getDataExtents();
if (dataExtents.size() == 0)
   return;
DataExtent extent = dataExtents.front();
GeoPoint point;
extent.getCentroid(point);
GameCodingNinja GameCodingNinja
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Getting the position of a loaded geo tiff

Thank you so much! That exactly what I was looking for.
Loading...