# xml define area

## Recommended Posts

I want to define an area in which an Element must be visbile

This Area is easy enough:

N31-W86             N31-W85

-------------------------

|                            |

|                            |

|                            |

|                            |

|                            |

|                            |

-------------------------

N30-W86             N30-W85

With following Code:

```         <Macro Name="POSLA">(A:Plane Latitude, degrees)</Macro>
<Macro Name="POSLO">(A:Plane Longitude, degrees)</Macro>
<Element>
<Visible>@POSLA 30 >= @POSLA 31 < &&</Visible>
<Element>
<Visible>@POSLO -86 >= @POSLO -85 < &&</Visible>
<Element>
<Position X="150" Y="595"/>
<String>test-zone 1A%</String>
</Text>
</Element>
</Element>
</Element>
```

But how to define an Area that is a Triangle or Trapezium or a Circle?

Bassy

##### Share on other sites
 Help AVSIM continue to serve you!Please donate today!

The circle case is straightforward.  If the distance from the center of the circle to the point in question is less than the radius of the circle, the point is inside the circle.

For polygons, things get exciting...

http://geomalgorithms.com/a03-_inclusion.html

##### Share on other sites

could you give a hint of code for the circle case?

i'm trying for days, but cannot find a solution...

thanks,

##### Share on other sites

The Flight Sim gps engine contains GeoCalc variables that will return distance between a pair of lat/lon coordinates.  The center of the circle should be GeoCalcLatitude1, GeoCalcLongitude1, and POSLA and POSLO will be GeoCalcLatitude2, GeoCalcLongitude2.  Then, GeoCalcDistance will yield distance between those two points using whatever units you want (for example, nmiles).

To read more about gps variables and how to set up the XML script, please take a look at FS9GPS Module Guidebook.  GeoCalc Group variables start on page 198 and GeoCalcDistance is discussed on page 199.  There are enough XML examples in that reference that you should be able to set up your circle condition.

Bob

## Create an account

Register a new account

• Tom Allensworth,
Founder of AVSIM Online

• ### Hot Spots

• Flight Simulation's Premier Resource!

AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!