I have a flat projection of a small map in osgEarth, and I want to move the map so that the loaded section is centered at the world origin. I don't want to break anything in the process, like ObjectPlacer.
Is the best method just to use a PositionAttitudeTransform above the whole osgEarth graph, or is there something built into the code to do this?
For what it's worth, I had to do the same thing for my application. What I did is to put a MatrixTransform above the osgEarth subgraph that translates the entire thing into my own coordinate system. I determined the UTM point (e,n) that I want to be at the origin and translated by
I don't use the ObjectPlacer, but I think you're right in assuming that it will return a position in osgEarth's coordinate system (UTM for me). So you'd have to transform that by the same matrix as well.
I'm attempting to combine osgEarth and osgOcean, something I haven't seen done anywhere else yet. I described some of the problems I've been having on the osgOcean forum and this repositioning to the origin was suggested there. I don't know if it will help, but it's worth a try.
And I'm glad a simple transform will work. That's what I'm about to try even now.
And even with ObjectPlacer, as long as what it is placing is also below this offset matrix, no further conversion need take place.
What about scaling? It looks like osgEarth uses the lat and long as x and y values in flat projections. I could slap a scale matrix over it all, but then I'd have to rescale the normals as well to get it lit properly, which is computationally expensive. Is it possible to tell osgEarth to, say, multiply the lat and long by 110844.41 (which would make integers into meters at my chosen latitude) when it creates the terrain?
osgEarth uses whatever SRS you tell it to use in flat/projected. If you don't specify one, it takes it from the first layer. If you ask for WGS84, then you will get X=long and Y=lat (plate carre). If you want a local projection in meters (e.g. UTM), define one using the <profile> tag.