• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

How to crop image before resample

igr

Messages
113
I checked now again the inf files from map2bgl and there is one thing that surprised me:

Code:
[Source]

Type = MultiSource
NumberOfSources = 2

[Source1]

Type = BMP
SourceDir = "."
SourceFile = "15_[U]000004[/U].bmp"
Layer = Imagery
Variation = All
NullValue = 255,255,255
ulxMap =  16.69921875
ulyMap =  50.4575040204207
Nrows = [B]2048[/B]
Ncols = [B]2048[/B]
Xdim =  [B]2.14[/B]576721191406E-05
Ydim =  [B]1.36[/B]691156343294E-05
PixelIsPoint = 0
SamplingMethod = gaussian
Channel_BlendMask = 2.0

[Source2]

Type = TIFF
Layer = None
SourceDir = "."
SourceFile = 15_[U]000004[/U].tif
ULXMAP = 16.69921875
ULYMap = 50.4575040204207
xdim = [B]5.23[/B]868948221207E-09
ydim = [B]3.3[/B]3718643416245E-09
Nrows = [B]4096[/B]
Ncols = [B]4096[/B]
SamplingMethod = Gaussian

[Destination]

DestDir = "U:\FSX\modules\Maps2Bgl_X\bglcache"
DestBaseFileName = "15_17904_11048"
DestFileType = BGL
CompressionQuality = 80
LOD = 5,15

What kind of information does have the tiff that it has different settings than bmp? I thought they cover same area. I look for a way how to crop a image. For example the area is too wide and I want just a little town to stay on the area. So I would want to make a crop. But what then. I would need to reenter correct numbers. How do I get the correct numbers? Is there any program to help with it?
 
Last edited:
Hi,

One is the blend mask, the other the imagery. Apparently they have different resolution.
 
Hi there,

actually, you can crop an image with resample.exe; simply insert the desired NW/SE corner coordinates in the .inf [Destination] section like this:

UseSourceDimensions = 0
NorthLat = 50.7633907252
SouthLat = 50.7295009960
WestLong = 0.1414489746
EastLong = 0.2650431733

Obviously, the values you're using would be different. If you're not sure about the coordinates you can load the compiled full-extent image into TmfViewer.exe and use its coordinates readout for that purpose.

Cheers, Holger
 
Hi there,

actually, you can crop an image with resample.exe; simply insert the desired NW/SE corner coordinates in the .inf [Destination] section like this:

Obviously, the values you're using would be different. If you're not sure about the coordinates you can load the compiled full-extent image into TmfViewer.exe and use its coordinates readout for that purpose.

Cheers, Holger

I already have found the SDK manual (but still I think there is some better tutorial on internet and still cannot find the link).

I am not sure which method is the best.

What if the town (should stay on imagery) lies in the upper left corner of the bmp file, then I could crop it from the right or bottom right side. The size of image would change. But location is the same. What in this case? Must I change the xDim and yDim?

Well I read the manual, but thought I do not understand the things about dimensions. How can I get the size?

bap2bgl uses LOD15 or LOD16 as source, and then converts is to LOD15 in both cases. How they calculated the xDim and yDim? Should I not take care about it? They say:


Size of each pixel in the X direction (Longitude) in degrees. For example:

9e-6 is 9 x 10 to the power of minus 6 degrees. See the table in QMID and LOD Values for some comparisons of meters and degrees per pixel.


Second column I don't understand at all!

In the case that the xDim and yDim are fixed values depending on resolution of the image (correct me if I'm wrong), than If I will make the crop from bottom or from right, so I need not to make coordinates and yDim and yDim corrections (?).

EDIT:
I did a test. I measured distance of area captured on bmp. It is 6320m on width. And the image is 4096x4096. But I still do not the same number as they have If I would try to divide 6320/4096 = 1.54m/px.

EDIT2:
Yet I don't understand how to get the correct row and column number.
 
Last edited:
I have overlooked that the size of pixel is in degrees, no in meters :-(

So I take these values (LOD15):
13,271477° is left side edge of the image
13,359382° is right side edge of the image
distance in degrees is 13,359382-13,271477
image width is 4096

Calculation:
(13,359382-13,271477)/4096 = 0,0000214612
Now explain to me why the number is so little. According inf files the number should be 2.14576721191406E-05
Does it mean, that the above is farmat of number that shifts floating point /100000 (5 zeros)?

OK than If the correct number is
0,0000214577
why I have
0,0000214612
Should be any chance to be more accurate? But still I think, that the area is big so the number I calculated should be precise enough. Right?

And why is there the Nrows and Ncols? I think that it is count of rows and cols that are in the square of the GMID grid! That means that If I would cut the the image, I must to calculate with this. This gives to me sense. If I will crop the square, so it will have less rows and cols...

So now I must to find way how to calculate the total count of cols. So I have LOD15 that is QMID 17. But I still have nothing just my brain, so tell my if I am right or wrong, but I just try find out some logic in it.
 
Last edited:
Hi there,

perhaps I wasn't clear but the method I described using the .inf file doesn't physically crop your source image; it just allows you to compile a subset (smaller window) of the entire source image. You don't need to provide anything else other than the NW and SE corner coordinates of your desired window and you can find those in TMFViewer or even Google Earth.

The discrepancy in your calculation could be from inaccurate figures for the edges of your image. For example are those values for the edges of the first and last pixel or their centerpoints? In any case, the discrepancy is pretty small.

For the Xdim/Ydim values in the inf it's optional to use either regular decimal notation or "E notation". Here's how Wikipedia defines E notation:

E notation
Most calculators and many computer programs present very large and very small results in scientific notation. Because superscripted exponents like 107 cannot always be conveniently represented, the letter E or e is often used to represent times ten raised to the power of (which would be written as "x 10b") and is followed by the value of the exponent. Note that in this usage the character e is not related to the mathematical constant e or the exponential function ex (a confusion that is less likely with capital E); and though it stands for exponent, the notation is usually referred to as (scientific) E notation or (scientific) e notation, rather than (scientific) exponential notation (though the latter also occurs). The use of this notation is discouraged by publications[2].

source: http://en.wikipedia.org/wiki/Scientific_notation

Cheers, Holger
 
correct calculation of xdim

Hi there,

perhaps I wasn't clear but the method I described using the .inf file doesn't physically crop your source image; it just allows you to compile a subset (smaller window) of the entire source image. You don't need to provide anything else other than the NW and SE corner coordinates of your desired window and you can find those in TMFViewer or even Google Earth.

Thanks for reply, but this is the problem. If I want to cut many of the sceneries, they are dozens of dozens. So this would be a lot complicated to specify every image but I am not still decided. I just want to understand both ways and the basics to make decision. Is not better to crop image by batch file or make just testing image before the crop? I could watch it and check before bgl conversion.

Hi there,
The discrepancy in your calculation could be from inaccurate figures for the edges of your image. For example are those values for the edges of the first and last pixel or their centerpoints? In any case, the discrepancy is pretty small.

The calculation comes from LOD15 bgl loaded into TMFViewer. But I did not take care about y axis. Edit: And revised again on the top of the image, the "input" values (coordinates) in TMFViewer are correct. TMFViewer - it is very good tool, but I think it is not possible to copy the coordinates(?). I think if I will find correct number to inf, then it must be exact and OK. But the values were generated by maps2bgl and from G. server. There should not be the little difference, but if it would be not much should happen. Because the image is on its wight place,and I think that the value 0,0000000035 is really little. On the LOD15 size it could be just few cm. I did the measure in very big close zoom having the pixel zoomed on half of its size.

Also I don't understand why these numbers are different from the QMID system:
Code:
QMID   LOD  	Block size (degrees) 	One Pixel (degrees)	Meters/pixe
17     15	0.002746582          	1.06871E-05	        1.19
I appreciate your help.

Note:
The reason why I am so interested in xdim and ydim (and rows and cols to be mentioned later) is that I am going to change the resolution of the LOD16 source images to LOD15 with less size than maps2bgl can offer.
 
Last edited:
Hi,

One is the blend mask, the other the imagery. Apparently they have different resolution.

What is the blend mask for? I know that blend mask serves to hide some parts of the image. But that gives no sense why maps2bgl uses masks.
 
Last edited:
What is the blend mask for? I know that blend mask serves to hide some parts of the image. But that gives no sense why maps2bgl uses masks.

That's indeed what it is. I have no idea why map2bgl would use it. I never used that tool.
 
Maps2Bgl uses a white blend mask, which does nothing except provide an .inf in which you can substitue your own blend mask.
 
New findings and questions

But how could I edit the tiff? In normal raster editor? It seems like it is nothing good for - in my situation it seems to be useless. But in this post I need to ask you how can I make mask. Must it be in tiff? Will it consume less size than bmp?
 
Back
Top