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

Black edges WGS84 imagery

Messages
137
Country
germany
Hello guys,

I am new here and also new in creating photoreal sceneries. I work on an airport in Florida and started with my satellite image. I already converted my image from jp2 to tif and merged six files together. Then I converted it to WGS84 and added my water- and blendmask. However I can't remove these annoying black edges at bottom and top of my satellite image. I already saw some threads in which the problem was discussed, but I couldn't solve it.
Thanks in advance!

2015-11-18_16-1-38-62mis4r.jpg
 

Attachments

The lower one won't be a problem, but the upper one worries me, because my photoscenery area continues there. I really don't know how to handle these edges in the blend- or watermask.
Here is my blendmask. If you have hints how to do it better in photoshop of course please tell me.

blendmasklykdp.png
 
Are the black lines in the imagery itself or do they result after you compile it? Also, I have never used .tif images for my imagery, just for the masks. I have always used 24-bit bitmaps instead. (This may not make a difference though)
 
Its where it's been projected into wgs. The use of nullvalue =0,0,0 might work. But might stop the blend mask from working if I recall correctly.
 
They are in the aerial imagery file after converting from NAD83 to WGS84 with GDAL.
@Shaun
I included it in the .inf file. I still don't know why it doesn't work.:rolleyes:
 
Unless your image wasn't properly georectified to begin with (which is unlikely), GeoTIFF to INF shouldn't cause any trouble. What Shaun said about the projection is correct.

If you look at a shear mapping (not the same type of transformation, but as an example), you'll notice a similar distortion and find that the edges no longer correspond to the rectangle that originally bounded the image before the transformation.

320px-Mona_Lisa_eigenvector_grid.png


Anyways, you should set the NullValue (in your source section(s) of the INF) to the same RGB value that you used in the -dstnodata argument for gdalwarp to make the resample tool ignore areas of missing data.
 
All right! Yes, the projection seems to be correct. Working with the gdal tool was something new for me. I only worked with SBuilder in the past.
Do you mean this one?
gdalwarp -srcnodata 0 -dstalpha in.tif out.tif
 
Last edited:
-dstnodata value [value...]:
Set nodata values for output bands (different values can be supplied for each band). If more than one value is supplied all values should be quoted to keep them together as a single operating system argument. New files will be initialized to this value and if possible the nodata value will be recorded in the output file. Use a value of None to ensure that nodata is not defined (GDAL>=1.11). If this argument is not used then nodata values will be copied from the source dataset (GDAL>=1.11).
(http://www.gdal.org/gdalwarp.html)

So if you use -dstnodata "255 0 255" in gdalwarp you want to use NullValue=255,0,255 in the INF.
 
You can try reprojecting them with the switch to ignore no data area, or another solution is when you have black pixel edges conflicting with the blend and water masks is to use Image Magick and then generate a batch file to change all pure black pixels in the image to something else (like 1 pixel brighter than black, hence RGB - 1,1,1). After you do this, you simply compile all tiles that have water masks separately from the tiles that do not (and you adjust the null value in the INF accordingly to what you are compiling). You can also just replace all pixels in a paint program of your choice. After you do this, your water and blend masks will still use pure black, so it should not conflict. If you get a different issue (water bleeding through land), then try a completely different color to fill only on the edges of the tiles, like a hot pink or purple or bright red (colors which almost never appear in nature), and then set your null value differently whether you are compiling tiles with masks or tiles without masks, hence to the new color instead of black, then it will no longer conflict. After all this, you can actually have NO black pixels in your non-mask images (1,1,1) instead of (0,0,0) and the edges will not even be black at all (they can be maroon or some other color). Most of us maintain our coordinates separately from the images in a separate file (dump them with Gdalinfo ahead of time). Then you can edit images in any program while not worrying about losing the GEO-INFO in the file.

The ImageMagick code to fix the pixel colors is as below (have to download and install ImageMagick of course). You can also use ImageMagick to ONLY fill the edges of the image itself with another color. You cannot technically clip the edges unless you maintain an alpha layer or some other extra channel.

SETLOCAL EnableDelayedExpansion
IMCONV = %PROGRAMFILES%\ImageMagick\Convert
REM - RUN BATCH BELOW

convert "c:\MyImages\Image1_AfterGdalWarp.tif" -fill RGB(1,1,1) -opaque black \FinalImage1.tif
convert "c:\MyImages\Image2_AfterGdalWarp.tif" -fill RGB(1,1,1) -opaque black \FinalImage2.tif
 
Last edited:
Thank so much guys!
I will try all the suggestions one by one and reply you which worked.
 
You could also trim the extents of the geotif just inside the black wedges using -te in the gdalwarp command:

-te West South East North

example:
gdalwarp -of GTiff -co "INTERLEAVE=PIXEL" -t_srs "+proj=latlong +datum=WGS84" -r cubic -te -82.327 28.782 -82.297 28.822 "input_1.jp2" "input_2.jp2" "output.tif"
 
@Shaun
I tried your suggestion, but it doesn't work for me. Can you please send me an example .inf from one of your sceneries and a quick preview of the .bgl in the Terrain Mesh File Viewer?

@ollyau
I tried the following command:
gdalwarp -dstnodata "255 0 255" Ocean_Reef_1_A.tif Ocean_Reef_1_Anew.tif
Then I set the parameters in the .inf which I added below, but still the black edges.

@dtmicro
I haven't tried "ImageMagick" yet, but first of all I have to get into this.

@JRobinson
Is this before converting from NAD 83 to WGS 84? How should I do this? The black lines aren't straight in the imagery (see image below).

From time to time I believe that I am too stupid for this.:confused:

There was also this error while creating my .bgl.

errorrcsx2.png


imageryqzj24.png


watermaskumkqz.png
 

Attachments

Is this before converting from NAD 83 to WGS 84? How should I do this? The black lines aren't straight in the imagery (see image below).

It was before reprojecting, what I did was gdalwarp the imagery once without the -te switch which resulted in the black wedges, I then added that geotif as a "background > from disk" in SBuilderX. Once that's properly geo-rectified in SBuilder you can get the coords for the West, South, East, and North extents by hovering the cursor just inside the black edges. So then amend your gdalwarp command adding -te West South East North using the trim values you came up with and reproject it again.

Really though this isn't going to help you since you stated "the upper one worries me, because my photoscenery area continues there...", I should have read your posts more thoroughly, you'll end up with a gap between this source and the one that joins it to the north if you trim it like this so disregard at this point.

How large did "Ocean_Reef_1_A.tif" come out (pixels X & Y, filesize)? Is there any reason you can't just add more .jp2s to your gdalwarp command and reproject the whole area into one large .tif? If you can get it all into one source that would be the easiest, then you could just do your complete blend mask on the whole thing and eliminate the black wedges that way. How many .jp2s do you have in total, and how large are they in pixel dimensions?

Otherwise (if the size of the complete .tif is prohibitive) you could reproject multiple sources and then use a multi-source .inf to join them and resample will handle the joints. That makes the blend mask a bit more difficult because you'll need to maintain continuity between one source and the next but it can be dealt with.

Don't worry too much about those errors in the resample window, I think we all see those every time, I think it has to do with the PhotoShop save that apparently doesn't write the .tif header exactly the way resample expects to find it.
 
Well... I downloaded 65 files for my photoscenery. All zip files together have about 7.68 GB.
For my part I showed you above I put six files together (60198x9388px, 1.57 GB) I wanted to avoid that the .tif is bigger than 4 GB because of the resampler.
I see your point with the multi-source .inf. Arno has written an experience for that on his website. However creating a blendmask for all 65 files worries me.
 
If you gdalwarp another 6 tiles together into a source that joins this one to the north and then put both of those sources together into a multi-source .inf the black wedges where they join won't show. You'll probably see a faint black line at the seam but for the most part resample will get the upper black wedge area on the southern source from the lower edge of the northern source. There's a workaround for the black line but given the scope of this project I doubt you'll notice them much. Try that next and you'll probably get an idea where to go from there.
 
Back
Top