Sign in to follow this  
Guest artmartin

Extracting lat/long from positions within scenery tiles

Recommended Posts

I've been working on adding a bridge-building tool into my autogen creation program that would allow the user to do the following:1. Create, using the available FS objects (specifically the bridge span and ramp segments), a bridge definition object. That object would include which default object would be used for the end ramps of the bridge and which object would be used to fill in the span between those two ramps if any remaining space existed. There would also be parameters for the lengths of each of the segments and any rotation that was necessary for those objects to fit together. Determining those distances and rotations might require the user to do some trial and error since it would be extremely difficult to find and extract that info from whatever file they exist in within FS.2. Once the bridge definition object exists, the user then draws a rectangle on the scenery tile image where they wish the bridge to be drawn.3. The ramp segments are set at each end of the rectangle opposing one another and, if there is any space left between them based on the defined lengths, span segments are placed to fill in the gap. Now here comes the quandary. I already have the ability within my program of placing simple (but incomplete) bridges by adding custom GUI classes in the FS DEFAULT.XML file with a single object containing a span segment and using the angled multiple GUI object placement tool to put down a line of those segments at user-defined intervals. You end up with a bridge but without the end ramps. The nice part to this method is that autogen objects are easy to reference for position since they only have to relate to the relative XY positions within the scenery tile image, not to their actual lat/long.Had a few local users over to the house last night to give them copies of my Phoenix area scenery and figured out the downfall. Made them a CD of the scenery directories and install of that was simple but then I realized that their DEFAULT.XML did not contain the required entries to be able to see my bridges. Since there's multiple development efforts going on across the world to do custom autogen objects that require entries in the DEFAULT.XML, it occured to me that it wouldn't be as simple as giving them my own copy to replace theirs. I would be running the risk of undoing any other customization that might exist. So I'm faced with explaining to them how to edit or copy and paste in the necessary lines. That seems pretty shaky to me if one wants to distribute new scenery. So now I'm leaning towards not using the autogen object method of defining the locations of the bridge segments but instead using compiled BGL's of XML code to do the job. Then it's as simple as including the compiled files in with your scenery. Here's the rub to this idea. The XML code locating the objects must do so in lat/long. The scenery tile image, as it's displayed for adding autogen is square since its original size is 256 X 256. However, in real life it may represent an area that's tall and skinny or short and fat depending on the latitude range it falls in. I can deduce the lat/long of the NW corner of the tile by its filename but it seems that extrapolating a lat/long of an XY pixel position on the image would not be an exact science unless one did some very heavy math.My question here is the following. Is this potential deviation a big deal since each tile represents such a small area? Next, what exact area in degrees/minutes/seconds does each scenery tile represent? Third, does anyone else have the mounting concerns I do about locating scenery design objects using the DEFAULT.XML file? By the way, made two new friends last night and I recommend this to all simmers. Find people in your local area and get together to share your experiences. It's great fun. Might just have to go to the convention now to continue this trend.Art Martin

Share this post


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

Hi Art.Each photoreal tile represents an actual LOD13 area in the FS world.The tiles are 256 x 256 ( or 2^8 ). We know the LOD13 span for longitude ( 120 / 8192 or 0.0146484375 degrees ), and latitude ( 90 / 8192 or 0.010986328125 degrees ). 8192 happens to be 2^13... which is why it is called LOD13.2^21 ( 2097152 ) should be the span of pixels in a photoreal tile:longitude = ( 120 / 2097152 ) = 0.000057220458984375 degreeslatitude = ( 90 / 2097152 ) = 0.00004291534423828125 degreesIn other words, ( 0.0146484375 / 256 ) is the span for longitude for the pixels, and ( 0.010986328125 / 256 )is for the latitude span of the pixels.If you know the NW corner of any tile, then you should be able to calculate the exact position of each pixel within each tile using the above spans. Position 1,5 from the NW corner would be:( W + ( 1 * 0.000057220458984375 ))( N + ( 5 * 0.00004291534423828125 ))Each pixel, of each photoreal tile, has an exact address in the sim. The actual math is actually pretty simple.Dick

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this