# How to find Generic Building coordinates from AGN

#### Vogel

Hi,

I need help to find coordinates of the 4 points of a Generic building.

A Line extracted with agn2txt is writed like this:
Genericbuilding X Y X' Y' X'' Y''

The coordinate of point1 is easy to find: X1=X and Y1=Y
The coordinate of point3 seems to be: X3=X1+X'' and Y3=Y1+Y''
The coordinate of point4 seems to be: X4=X2+X'' and Y4=Y2+Y''

But I'm not sure of method to find coordinate of point2(X2,Y2) !? Are X' and Y' Vector coordinate between point1 and point2 or X/Y offset ? So what is the formule to apply to find X2 and Y2 ?
X2=X1+X' ? And Y2=Y1+Y' ? Or I'm wrong ?

When I play before with those value and I compare result with Annotator, I remember that I found a factor between X' and X'' but I'm not sure and I haven't the code front of me... And In fact I've never well understanded those X' and Y' param.

Last edited:
Hi,

The first point is the location of one corner of the building. The second set is the direction vector (normalized) of the direction of the building. The third set of coordinates is the offset.

So you get the opposite corner by p1 + dot(p2, p3)

thank Arno

Hard to understand for me, sorry but I'm too bad in Mathematic

can I defined it in C# like that ?
PointF point1 = new PointF(X,Y);
Vector vector = new Vector(X',Y');
Vector offset = new Vector(X'',Y'');

Point2 = Point1 + vector;
Point3 = Point1 + Dot(vector,offset); => the result of Dot is a Scalar number ?
Point4 = ?

sorry...

Last edited:
Hi,

It is slightly more complex. I only do the reverse calculation in scenProc now, so hopefully I didn't make a mistake in these formulas.

From the AGN file you get three vectors: position, direction and offset.

The direction is one axes of the coordinate system used. You get the second axis by taking the cross product of direction and the upwards vector (0,0,1). Let's call these two directions dir1 and dir2 from now on.

Then the four points of your building would be:

p1 = position
p2 = position + dot(dir1, offset) * dir1
p3 = position + dot(dir1, offset) * dir1 + dot(dir2, offset) * dir2
p4 = position + dot(dir2, offset) * dir2

thanks Arno, I will try with...

Hi Arno,
I know, this is a really old thread, but as the title fits my query I thought I just revive it
I'm trying to get rid of some autogen buildings on my taxiway and already got some great help from George, Gary and Roby among others.
George helped me to identify (with his great tool) the agn file concerned and I used your tool agn2txt to decompile.
But now I'm stuck again. I don't really understand (and can't find anything about it in the wiki or forum) in what format the coordinates of the corners are represented.
With FSX in slew I can get the corner coordinates (in DMS?) of the building i want to get rid of and I thought I just have to convert it to a decimal coordinate
but that seems not to be the case. Could you give me your insight how to determine these coordinates.
As I'm using TP, annotator is not working for me.
Cheers,
Luc

Hi George,
it looks like you're roaming around giving a helping hand on all levels

https://www.fsdeveloper.com/wiki/index.php?title=AgnTools

In the decompiled file I find this info (one line as ex.)
AGNGenericBuilding {6f1e985a-1f64-4c73-925b-c0a327bda2df} -0,41203498840332 -0,301455020904541 0,0612549781799316 -0,998123168945313 0,0214548110961914 0,0160870552062988
After reading both your and my link it looks like the coordinates are relative position within the QMID square?
It looks the value can vary between -0.5000000000 and 0.5000000000 so therefore can I assume that x=0 y=0 would be the center of the QMID15?
If I understand correctly than I could make a 100x100 grid in the QMID15 and as the approximate measurements are 1.2 km x 1.2 km then every "step" in m y grid
would be equal to 12 meter. So if i would find the corner of the QMID15 (using slew in FSX) I then could somehow guess the relative position inside the QMID of the building I want to get rid of?
Am I somewhere near the correct explanation or am I way off?
Cheers,
Luc

Your assumptions are correct. But would it not be easier to use Annotator to remove the building?

Yes, it certainly would be! Unfortunately annotator doesn't work with Tileproxy
That's the reason I'm struggling to find an "easy" way to get rid of some autogen buildings on my (stock and other) airports.
Cheers,
Luc