Jump to content
Sign in to follow this  
Guest rbrown3rd

Landclass Question

Recommended Posts

Guest rbrown3rd

I decided to open a new thread with this since the original was getting so long.I am totally new at this. I made s few successful landclass files by hand digitizing using Landclass Assistant. I decided to try using the NLCD files as described by Orlando.I changed the palette in the .tiff to represent proper FS Texture numbers as gray levels. Reading the indexed .tiff shows that they are correct. I then discarded the color information to create a grayscale image and saved it as a .raw.I cannot get the .bgl to come out right though.My source file is 6750 x 6772 and it covers the area of 82.5 west, 28.125 north by 80.6250 west, 26.7188 north. This is less than the calculated LOD5 coverage. 1/4 to be exact.My .inf file looks like this:LOD=5NorthLat=28.125SouthLat=25.3125WestLong=-82.5EastLong=-78.75DestDir=.DestBaseFileName=landclassType=ClassU8SourceDir=.SourceFile=landclass.rawLat=28.125Lon=-82.5NumOfCellsPerLine=6750NumOfLines=6772CellXdimensionDeg=0.00278CellYdimensionDeg=0.00278I got the Cell sizes by dividing the lat coverage by 6772 and the long coverage by 6750. I just rounded them off.Question: Do I divide the latititude and longitude coverage of the LOD or of the .tif image which in my case is less than the LOD5 coverage?Question: I have been using Photoshop to edit the palette of the NLCD .tif file. When I save it as a .raw file it seems to become distorted in the x and y. How do you guys go from the grayscale .tif to the .raw file?Can someone tell me if there are any obvious errors in what I am doing here?Thanks very much,Bob

Share this post


Link to post
Share on other sites
Guest christian

Your file HAS TO cover LOD5, in fact you can drop the LOD5 as its chosen what ever you say the LOD is. If your area is not LOD5 then you have to make the file bigger and fill the rest with some number, I think 254 means 'transparent', so you have to experiment there...>I cannot get the .bgl to come out right though. what's wrong?>Question: Do I divide the latititude and longitude >coverage of the LOD or of the .tif image which in my case is >less than the LOD5 coverage? tif image, but should be the same as LOD5 anyway...>Question: I have been using Photoshop to edit the >palette of the NLCD .tif file. When I save it as a .raw file >it seems to become distorted in the x and y. How do you >guys go from the grayscale .tif to the .raw file? RAW doesn't save any x/y values. When you open a raw file you have to specify what values those are. Also select 8 bit, 1 channel. I usually make my own palette that goes with the raw file. That way I have colours...Cheers, Christian

Share this post


Link to post
Share on other sites
Guest rbrown3rd

Thank you Christian. I have had some odd results after converting the .tif to a .raw file at the original resolution. The grayscale .tif looks fine at 6750 x 6772 but the .raw file using the same resolution looks distorted as if it had been stretched diagonally. I have never seen that happen with smaller files. My goal was to be able to resample the NLCD .tif files without resizing them using my graphics package. I have not had much luck that way. Also, even after creating a palette to convert the .tif colors to FS texture numbers the resulting .tif file seems to have some pixels that have shifted by one number to what are in some cases invalid textures.Sorry to ask so many questions but I am at that beginning point of the learning curve.

Share this post


Link to post
Share on other sites
Guest rbrown3rd

I am struggling to get this to work. I am trying to get one LOD5 area converted to a Landclass bgl using the NLCD .tif files as a source. The .tif file I am working with covers one fourth of the LOD5 area. It is 6750 x 6772. I edited the .tif file in Photoshop to change the color indexes to the FS texture numbers. I changed the mode from indexed color to grayscale. I then saved it as a .raw file. I did the calculations for my .inf file based on the LOD coverage:3.75 degrees wide / 6750 pixels = xcellsize of .0005552.8125 degrees high / 6772 pixels = ycellsize of .0004133I do the processing using the following:resample landclass.inftmfcompress landclass.tmf lfinal.tmfdel landclass.tmftmf2bgl lfinal.tmf landclass.bglThe resulting bgl has a bunch of unknown gray textures and appears to be totally garbage. Can anyone help this poor soul get back on the right track?

Share this post


Link to post
Share on other sites

Hi Bob.One fourth of an LOD5 area is going to be 64 x 64 bytes.The SDK says there is no advantage to trying a finer resolution for the source... it needs to be 256 x 256 ( some say 255 x 255 ), for the entire LOD5 area.First, you'll need to make a 256 x 256 8-bit RAW file filled with value #254 ( transparent ). Now you have at least a null value for each byte.Second, you'll need to reduce or resize the NLCD data to it's appropriate size. If it is one quarter exactly, then reduce it to 64 x 64. Either resize the file, or do it by hand, guesstimating the correct class for each cell.Then cut'n'paste the reworked data onto the transparent RAW background, giving you a 256 x 256 RAW file.You may find it easier to use LandClassAssistant, by John Cillis, to add the data to the cells.A commercial solution is FSLandClass, by Burkhard Renk.Also, there may be a limit of 2559 pixels, for each direction, that was discovered by Andrew McLean to be true for photoreal bitmaps. I don't know if there is a limit for landclass in resample.exe.Dick

Share this post


Link to post
Share on other sites
Guest rbrown3rd

Thanks Rumbaflappy. I guess I was under the impression that one could resample the full sized NLCD .tif. My mistake but what you say makes a lot of sense. So, then I would just use Landclass Assistant or recalculate the .inf file by hand so that it represents the coverage in degrees divided by 256?

Share this post


Link to post
Share on other sites
Guest rbrown3rd

One small correction. What you say about the area coverage of one fourth being 64 x 64 is really not true. It would actually be 128 x 128 for one fourth of the area. Bob

Share this post


Link to post
Share on other sites
Guest

"Second, you'll need to reduce or resize the NLCD data to it's appropriate size. If it is one quarter exactly, then reduce it to 64 x 64. Either resize the file, or do it by hand, guesstimating the correct class for each cell."Rhumba is right.To resize the NLCD data to its appropriate size you may do the following (in Photoshop)1. Open file.2. go to Image / Image size... 3. In Pixel Dimensions enter 128 and 128 (not 64 ;-) )4. Make sure Resample Image is checked, but select Nearest Neighbor to avoid creating invalid pixels in the process - those that shows as gray squares or give errors.Hope it helps--Daniel R. Careri

Share this post


Link to post
Share on other sites
Guest rbrown3rd

Thanks Daniel. Either I am getting very punchy or something strange is happening when I resize (resample) in Photoshop or when I go through the palette changing process to end up with a .raw file. For example, I have an area that has an index in the .tif file of 82 and I want it to be 35. So, I set that in my color lookup table and make the change. Somehow when I end up with the .raw file some of them have been changed to 34.

Share this post


Link to post
Share on other sites
Guest rbrown3rd

There seems to be a shifting of pixel values when I discard the color information to make a grayscale image prior to creating a .raw file. Have you ever run into that in Photoshop? In most cases it seems to be just one number as in 35 to 34. This has me baffled. The shifts are not widespread but enough to be a nuiscance.

Share this post


Link to post
Share on other sites
Guest rbrown3rd

I created an image and flooded it with a single color. The image was an indexed image. I verified that it was indeed just one color. I then discarded the color information to creat a grayscale image. This is converting from a 16 bit image to an 8 bit image. This process introduced what appears to be random 1 bit noise. The color codes have a sprinling of codes that are one number off. My proof is at the bottom of this post. I did some research and found the following verification that this is true. http://www.aim-dtp.net/aim/photoshop/v5/16-bit_noise.htmOne can correct it by hex editing the Photoshop.exe file but that is beyond me.snap2575.jpg

Share this post


Link to post
Share on other sites
Guest christian

Hmm, I never had any problems what so ever with raw and photoshop.The LOD5 gridsize is actually 257x257. I know this for sure, because I usually write the data section directly into the bgl files. That's right. I can make landclass bgl files without using resampler at all...Cheers, Christian

Share this post


Link to post
Share on other sites
Guest christian

ok. when you convert from 24 to 8 bit there are several methods. You chose the dither one, which is wrong. Don't use rgb at all. Create a new 8bit image with your own custom palette (not greyscale) and redo everything from scratch. If you have a rgb colour image already, convert to 8 bit, but so that the colours get translated 1:1. Then you have to edit the palette, because the colours may look right, but they don't mean anything. What's important is the position where the colour is in the palette. So you have to shift your colours to the right positions. You can do that with the select and fill tools...Cheers, Christian

Share this post


Link to post
Share on other sites
Guest rbrown3rd

I would not have this problem if I were creating the file from scratch or hand digitizing it with something like Landclass Assistant. It occurs because I am trying to convert the NLCD .tif file into a landclass file using Photoshop. I can resize the image down to 256 x 256 or whatever I need using nearest neighbor. But when I go to change it to a grayscale image enroute to .raw format the noise appears.I am sorry to be so slow with this but how can I use the .tif file without going through the conversion process from 24 to 8 bit?

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...