# Cell dimensions

## Recommended Posts

I seem to remember seeing a utility that will calculate the correct cell dimensions with corrections for longditude so that resample does not have to stretch the image.Could somebody please jog my memory as to what it is called and maybe where I can find it.Regards,Tosh

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

Hi Tosh.You could try LODCalc. I use it often.Dick

##### Share on other sites

Hi Dick,Thanks for the info but this is not what I mean. I need to input the north, south, east and west limits of a bitmap and output the celldimensions with auto corrections for longitude so that resample will not stretch the image during processing.Regards,Tosh

##### Share on other sites

Hi Tosh.I don't recall a calculator that does just that. I do have a method for defining the Cell dimensions that gives me error-free slices.Here's an example:; Delavan LOD8[source]Type = CUSTOMSourceDir = "."SourceFile = "Delavan.bmp"; textures.lowerLeft.latitude=42.5 {Terrascene text output}; textures.lowerLeft.longitude=-89.0831 {Terrascene text output}; textures.upperRight.latitude=42.9167 {Terrascene text output}; textures.upperRight.longitude=-88.5 {Terrascene text output}; NorthLat = 42.890625 {derived from LODCalc}; SouthLat = 42.5390625 {derived from LODCalc}; EastLong = -88.125 {derived from LODCalc}; WestLong = -88.59375 {derived from LODCalc}; X span = ( (89.0831) - (88.5) ) = 0.5831 {span in degrees}; CellXdimensionDeg = ( 0.5831 / 9968 ) = 5.8497191011235955056179775280899e-5 {span divided by the pixels}; Y span = ( 42.9167 - 42.5 ) = 0.4167 {span in degrees}; CellYdimensionDeg = (0.4167/ 9660 ) = 4.3136645962732919254658385093168e-5 {span divided by the pixels}Lat = 42.9167Lon = -89.0831CellXdimensionDeg = 5.8497191011235955056179775280899e-5CellYdimensionDeg = 4.3136645962732919254658385093168e-5NumOfCellsPerLine = 9968NumOfLines = 9660[Destination]DestDir = ".test"DestBaseFileName = "Delavan"MakeBMP = 1UseSourceDimensions = 0NorthLat = 42.890625SouthLat = 42.5390625EastLong = -88.59375WestLong = -89.0625So if you know the actual bounds of the image, and the number of pixels, you can get an exact resample. That doesn't mean the image won't be stretched, if the size of the image in pixels isn't right.Resample is going to create a 256x256 slice for each LOD13 Area, and if the size in pixels for the Area is 128X128, it will stretch the image by a factor of 2 each way. In that, we have little choice, as the source image determines that factor of the stretch.Terrascene derived images can be forced to 4.8 meters per pixel sizing, and that does eliminate the image distortion. Aerial photos cannot be forced, as they are usually available in 2, 4, or 8 meters per pixel, so there will be some stretching of the image, if you want it placed exactly to the degree bounds.Dick

##### Share on other sites

Hi Dick & Tosh...Dick's method does work well, its my approach also. My only issue in doing this was error introduced by only having the runway ends that I could count on for an accurate geo reference, and also an accurate point to measure image pixels from.While perfect for a small scenery that basically just focuses on the runway, tiny errors will magnify over 30km to become a problem.From a recent thread on this forum, I was turned onto a marvelous utility for mapping terrain images in the USA...if you focus on US, then this is a sweet tool, called USAPhotomaps.zip by a fellow named Cox at http://jdmcox.com.It is a wonderful front end for the usgs doqq images, it downloads them and assembles a mosiac for you very quickly, and using his other utility bigjpg.zip, you can save the file as a big jpeg. Last night I tested my first effort using his tool, in only three days, I had the 30km between bowerman field and Elma muni downloaded colored, and alpha created. Now the challenge of fitting the photo to elmas runway and still having it blend sweetly to Bowerman.What really helped was that the USAPhotomap utility also keeps track of the georeference on the photos in dec degrees out to 6 decimal places. Course I couldn't know what errors exist in this utility, but it seemed worth a try, so I picked easy points at the extents of the image, making it now just as convenient to set up cellx and celly parameters as before when I only had known points at the runway ends.The results were VERY good. I have a minor adjustment to make to have the runway fit (course the terrain could be more precise than msoft!), but its only a handfull of pixels to adjust and the fit at the other end was near perfect.Have fun!Bob Bernstein

##### Share on other sites

Hi Bob.Yes, the magnification of error was my concern when I started experimenting with the combination of Terrascene images and CUSTOM resampling. To my surprise, the Terrascene generated images, with a forced 4.8 meters resolution, were exact. One entire LOD8 Cell sized slice set joins perfectly to the next. Even tiny diagonal secondary streets line up perfectly. And the old resample doesn't seem to resample anything, as the textures are crisp.The same problem exists with photoreal, in that the bounds of the image must be exact, or the 'joints' won't fit right. Easier with Terrascene, as that is simply shapefile data that gets transformed to an image. Anything that can help determine the bounds of the image accurately is a great help. As you have guessed, the data by M\$ is probably "off" just enough to make the problem worse, not better... so the image georeferences are probably better than the sims airfields.Dick

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