Jump to content
Sign in to follow this  
Guest artmartin

Getting geo position from photo texture filenames?

Recommended Posts

Guest artmartin

I know I once saw an article about this but can't find anything at this time. Scenery texture tiles have very long numerical names like 003020000102101su.bmp and I know those digits represent where in the world that tile exists. I need to know this because I'm adding a feature to my new program where a user can view the tiles on a mosaic and be able to see how they fit with one another. When one lays them out in alphabetical order, some fit together properly and others don't. Anyone have a key to the format? Art Martin

Share this post


Link to post
Share on other sites

Hi Art,Have a look at TCalc by Rhumbaflappy. If I remember correct he has also included the source code of his tool and you should be able to see how he calculated them there.


Arno

If the world should blow itself up, the last audible voice would be that of an expert saying it can't be done.

FSDeveloper.com | Former Microsoft FS MVP | Blog

Share this post


Link to post
Share on other sites
Guest luissa

Hi Art,If you want I email you (later today) my VB code to build the file name from the location.Regards, Luis

Share this post


Link to post
Share on other sites
Guest bones

I've been looking at these recently too. The files are build up in blocks - 1, 4, 16 then 64. The first block for the 1033 1033 000 sequence is:000 001002 003then it grows to:001 002 010 011003 004 012 013020 021 030 031022 023 032 033and then to:001 002 010 011 100 101 110 111003 004 012 013 102 103 112 113020 021 030 031 120 121 130 131022 023 032 033 122 123 132 133200 201 210 211 300 301 310 311202 203 212 213 302 303 312 313220 221 230 231 320 321 330 331222 223 232 233 322 323 332 333That's in my neck of the woods anyway - I don't know if this sequence changes with Latitude. You end up with 64 textures in an 8 x 8 square with the start bitmap being 10331033000000.bmp and the final one being 103301033000333.bmpIt's your program that got me started on this! :)boneshttp://fsaviation.nethttp://www.precisionmanuals.com/images/forum/ng_driver.jpg

Share this post


Link to post
Share on other sites

The names of CUSTOM textures is a quadtree.The number at the right is the LOD13 quad.The numbering is much like land parcel descriptions in the US:NE quarter of the NW quarter of the SE quarter....Dick

Share this post


Link to post
Share on other sites
Guest artmartin

Wonderful, thanks all.Art

Share this post


Link to post
Share on other sites
Guest artmartin

Luis, would love to see it. My email is azstrummer(nospam)@aol.(nospam).com.Art

Share this post


Link to post
Share on other sites
Guest artmartin

Well, what I learned from looking at his source code is that it'll be almost impossible to go backwards from the filename to get the lat/long of the tile. The calculations are of the sort - take the latitude, perform a bunch of math on it and, if the result is odd, put in a 1 otherwise a 0. Same with the longitude, if it's result is odd put in a 0 otherwise a 2. Then add the two together and that ends up one of the digits of the 15 digit number. Each digit then can only be a 0, 1, 2, or 3. To get back to the lat/long from those options is mathematically impossible. Think the better task is to look for patterns as bones is doing below. Preliminary work there was making my eyes cross yesterday though. Tough looking at a string of 15 numbers and picking out characters from it without getting off in position. There has to be an easier way. Art

Share this post


Link to post
Share on other sites

Hi Art,Would it not be possible to see how the LOD squares are arranged from that source code? One you know which LOD square it is (for example cell numbers), it should not be too hard to find the lat/lon, as the size in degrees is fixed for these squares.


Arno

If the world should blow itself up, the last audible voice would be that of an expert saying it can't be done.

FSDeveloper.com | Former Microsoft FS MVP | Blog

Share this post


Link to post
Share on other sites
Guest artmartin

I would suppose so but the code has absolutely no commenting and it's difficult to deduce just what equation goes with what screen output. The program is a wonderful addon but I have to admit that some of its output is a bit cryptic to me and my limited knowledge of lod design and placement. I've only begun to scratch the surface of scenery design and this is all a bit overwhelming at times. I know I saw something on one of the forums one day that laid out character by character just what the tile names stood for and I just can't find that reference again. I'll continue searching in my lack of spare time.Art

Share this post


Link to post
Share on other sites
Guest artmartin

Woohoo. Thanks Dick.Art

Share this post


Link to post
Share on other sites
Guest luissa

>Well, what I learned from looking at his source code is that>it'll be almost impossible to go backwards from the filename>to get the lat/long of the tile. Hi Art,I do not know if you are referring to my source code as my first email (with a good destination address) was returned back to me. I tried a second time but I do not know if you got it.In any case it is very simple to go back from the file name to the location of the tile. I have just wrote a VB function to do that. I did not check it, but it would be very simple to correct it if you find any error when you run it. Regards, LuisPublic Function Custom2LL(ByRef Lat As Double, ByRef Lon As Double, ByVal FileName As String) As LongDim Char As String, N As LongDim DeltaLat As Double, DeltaLon As Double' Lat and Lon are passed by reference and, on exit, they' hold the latitude and longitude of the NW corner of tile' During the calculations:' Lat goes from 0 (north pole) to 180 (south pole)' Lon goes from 0 (W180) to 360 (E180)' If a wrong FileName is given, the function returns 0' otherwise returns 1Custom2LL = 0' the dimensions of a LOD0 quadDeltaLat = 90DeltaLon = 120' the NW corner of the flattened earthLat = 0Lon = 0' examine LOD0Char = Mid(FileName, 1, 2)If Char = "00" Then ' do nothingElseIf Char = "01" Then Lon = DeltaLonElseIf Char = "10" Then Lon = DeltaLon + DeltaLonElseIf Char = "02" Then Lat = DeltaLatElseIf Char = "03" Then Lat = DeltaLat Lon = DeltaLonElseIf Char = "12" Then Lat = DeltaLat Lon = DeltaLon + DeltaLonElse Exit FunctionEnd If' and then examine LOD1 up to LOD13For N = 1 To 13 DeltaLat = DeltaLat / 2 DeltaLon = DeltaLon / 2 Char = Mid(FileName, N + 1, 1) If Char = "0" Then ' do nothing ElseIf Char = "1" Then Lon = Lon + DeltaLon ElseIf Char = "2" Then Lat = Lat + DeltaLat ElseIf Char = "3" Then Lat = Lat + DeltaLat Lon = Lon + DeltaLon Else Exit Function End IfNext N' got here > no error' revert to normal latitude and longitudeCustom2LL = 1Lat = 90 - LatLon = Lon - 180End Function

Share this post


Link to post
Share on other sites
Guest artmartin

Thank you. Thank you from a very burned out programmer that was dreading figuring this out on my own. Art

Share this post


Link to post
Share on other sites
Guest artmartin

Luis, only found one error. Lats and longs were coming out quite a bit off and found that in this line: Char = Mid(FileName, N + 1, 1)it should read: Char = Mid(FileName, N + 2, 1) or N + 3 (can't remember which one worked. Don't have the code here at work)Once I changed that the coordinates came out perfect. Now for another question. I started creating my mosaic display by using the assumption that all tiles on the same row would have the same latitude value and all tiles in a column would have the same longitude values. It that a correct assumption with the world not being perfectly flat? It seemed to work for a directory that had few tiles but a larger one gave me weird results. Course I was doing all this way past bedtime last night so it may have just been my eyes and brain not focusing right. I'm thinking that it's possible all in a row or column will be almost exact over a large area so I may have to do some rounding for my comparisons.Art

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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • 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!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...