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

Strange output coordinates after resample

Messages
542
Country
australia
Hi. I am stumped at the moment, and I thought someone here might be able to help.

I had some jp2 files which I merged then reprojected and converted to GeoTiffs.

When I ran these all through resample, the output bgls were perfect, as in they were in exactly the right spot and lined up with the adjacent scenery I am trying to match. The colour needed adjusting, so obviously I had to use a graphics editor (GIMP) to edit the colours. Now I am having trouble resampling the edited files. I have tried a few methods. I tried the following in FWTools:
listgeo -no_norm original.tif > original.geo
geotifcp -g original.geo modified.tif modified_geotiff.tif

Which is a line I got from a GeoTiff FAQ page.

This spat out a new version of my GeoTiff from the edited file, but it seemed to only contain information on the Longitude, which I saw when I checked it out with gdalinfo.

I also tried another method, to create a world file (tfw) by using:

gdal_translate -co "TFW=YES" F:\USGS_Right_of_BS_AZNorth3FSX_JP2\AZ3_11_jp2Merge_wgs84_3band.tif F:\USGS_Right_of_BS_AZNorth3FSX_JP2\AZ3_11_jp2Merge_wgs84_3band_tfwgen.tif

which worked and gave me a tfw file with the folowing info:

0.0000082919
0.0000000000
0.0000000000
-0.0000082919
-111.3750263646
34.8750236610

Now I assumed that this should be my xdim, ydim, ulxMap and ulyMap, but when I used the following inf, I ended up with a bgl which showed the correct Latitude, but a Longitude showing 0.000007, which is strangely very close to the xdim and ydim value:

[Source]

Type = TIFF
SourceDir = "."
SourceFile = "AZ3_11_jp2Merge_wgs84_3band_edit1.tif"
ulxMap = -111.3750263646
ulyMap = 34.8750236610
xdim = 0.0000082919
ydim = 0.0000082919
Layer = Imagery
PixelIsPoint = 1
Variation = All
NullValue = 0,0,0

[Destination]

DestDir = ".\BGLs"
DestBaseFileName = "AZ_3JP11_edit1"
DestFileType = BGL
CompressionQuality = 85
LOD = Auto




Edit:

This is what resample is showing as it runs, for some reason it is not using the ulxMap value:


F:\USGS_Right_of_BS_AZNorth3FSX_JP2>resample.exe AZ_3JP6.inf
Microsoft Corp. Terrain Resampler 10.0.61637.0 (FSX-Xpack.20070926-1421)
Copyright (C) Microsoft Corporation. All rights reserved.

Resample Info File: 'AZ_3JP6.inf'
[Source] Type = 'TIFF'
[Source] Type = 'TIFF'
[Source] SourceDir = '.'
[Source] SourceFile = 'AZ3_6_jp2Merge_wgs84_3band_edit1.tif'
[Source] Layer = 'Imagery'
[Source] ULYMAP = 34.937518
[Source] XDIM = 0.000009
[Source] YDIM = 0.000009
[Source] PixelIsPoint = 1
[Source] Variation = 'All'
[Destination] DestDir = '.\BGLs'
[Destination] DestBaseFileName = 'AZ_3JP6_edit1'
[Destination] LOD = 'Auto'
[Destination] DestFileType = 'BGL'
[Destination] CompressionQuality = 85
Cell 428 of 4518 (9.47%); 0:00:24 elapsed, 0:03:49 remaining...





Edit 2: I had this problem with two files I had edited, AZ3_6_jp2Merge_wgs84_3band_edit1, and AZ3_11_jp2Merge_wgs84_3band_edit1.

For some reason AZ3_11_jp2Merge_wgs84_3band_edit1 is now running OK through resample, yet even by copying this good inf and filling in the details for No.6, AZ3_6_jp2Merge_wgs84_3band_edit1 is still failing to show ulxMap as it resamples.

Now I am even more confused!

Does anyone know what could be happening here?

Cheers,

Scott
 
Last edited:
Hi Scott:

IMHO, it is a prudent procedure to keep backups of all original source files before / during / after any conversion and editing.

Then, working with copies of the originals, one must back up the geo-referencing info contained in the Geo-TIFF and its accompanying files using an appropriate GIS utility before editing the ex: aerial imagery within it using a graphics editor ex: GIMP, or the geo-referencing info (and other metadata) may be corrupted and/or removed ...when the edits are saved back into the Geo-TIFF by the graphics editor.

There are numerous threads regarding this process here at FSDeveloper which you may wish to review; IMHO using Google's search with multiple word query strings may find such threads fairly quickly, ex:

https://www.google.com/#q=fsdeveloper GaryGB geoTIFF Geo-TIFF world file


After all graphical editing is finished, the geo-referencing info can be restored into the reformatted TIFF file (formerly a Geo-TIFF ! :alert:) from the backup made by the GIS utility via either the restore function in that same utility, or via a companion GIS utility specifically stated to be capable of reading and restoring geo-referencing info from the backup files created by the same one used to make the original geo-referencing info backup.



In your own example above, there is a difference from the syntax given as an example at:

http://www.remotesensing.org/geotiff/listgeo.html

"
listgeo - Dump GeoTIFF Metadata

Usage: listgeo [-tfw] [-no_norm] [-proj4] [-t tabledir] inputfile

The program listgeo takes a GeoTIFF file as input and dumps to the standard output a GeoTIFF "metadata" file, which is human readable, and may also be used as input to other programs which use the "GTIFImport" routine, such as geotifcp.

The -tfw flag may be passed to force generation of an ESRI style .tfw file as well as the metadata file. The ESRI world file is always given the same basename as the input file, with the extension .tfw. If one exists already it will be overwritten.

The -no_norm flag will suppress reporting of normalized parameters, and reporting of corner points.

The -proj4 flag forces listgeo to report the PROJ.4 projection string it uses for reprojecting corners to lat/long.

The -t tabledir flag overrides the programs concept of how to file the EPSG CSV files, causing it to look in directory "tabledir".
"

Hi. I am stumped at the moment, and I thought someone here might be able to help.

I had some jp2 files which I merged then reprojected and converted to GeoTiffs.

When I ran these all through resample, the output bgls were perfect, as in they were in exactly the right spot and lined up with the adjacent scenery I am trying to match. The colour needed adjusting, so obviously I had to use a graphics editor (GIMP) to edit the colours. Now I am having trouble resampling the edited files. I have tried a few methods. I tried the following in FWTools:

listgeo -no_norm original.tif > original.geo

AFAIK, you should receive a metadata file and not another version of your ex: aerial imagery.



geotifcp -g original.geo modified.tif modified_geotiff.tif

Which is a line I got from a GeoTiff FAQ page.

This spat out a new version of my GeoTiff from the edited file, but it seemed to only contain information on the Longitude, which I saw when I checked it out with gdalinfo.

[EDITED]

http://www.remotesensing.org/geotiff/geotifcp.html
"
geotifcp - Copy TIFF with updated GeoTIFF Metadata

Syntax: geotifcp [options] [-e esri_worldfile] [-g metadata] input output

The program geotifcp is identical in function to the LIBTIFF program "tiffcp", with the additional feature that if the "-g " option is used the GeoTIFF information from the (modified ! :pushpin: -GaryGB) file will be installed into the output file.

The "-e worldfile" option will override the tiepoint and scale information from the metadata file based on the contents of the ESRI worldfile.

If the "-g" option is not used the geotiff information from the (original ! :pushpin: -GaryGB) source file is preserved in the new output file.

"geotifcp" inherits all the other file-transformation capabilities of the tiffcp program; for help on the additional parameters give the command:

% geotifcp -h

The metadata format is the same as is described in the listgeo program. Normally metadata files for use with geotifcp are generated from a similar file with listgeo, and then modified by hand as required.
"

[END_EDIT]


Hope this helps ! :)

GaryGB
 
Last edited:
Hi Gary,

Thanks for all the info.

I'm not sure how, but I think you may be right in assuming I corrupted the original GeoTiff I had created. I have just gone through and made a new GeoTiff from the jp2 files, converted it to a 3 band image, and then used gdalinfo to get and copy the corner coordinates and pixel size. Then to be sure I made a new inf file also, re-edited the image and it finally ran through resample OK.

There were some really strange things happening before. At first resample was only using ulyMap, and not ulxMap, and then when I simply exchanged the coordinates for a longer version obtained by gdalinfo, it resampled with ONLY ulxMap. I can only assume, that somehow the corrupted image was causing this.

Again thanks for the info above. This is what I have been trying to find and learn to do this, in particular how to create a metadata file. As I said, I usually just use gdalinfo and then copy and paste this in to a text file from each original GeoTiff, so I can use that info later on, but I'm sure all of the above info will help a lot.

Cheers,

Scott
 
You could save yourself the trouble and just use GeoTIFF to INF, a utility I made that saves the geographic metadata into an INF ready to use with resample, so you don't have to manually calculate the values or re-georectify the TIFF after editing.
 
Thanks ollyau, that sounds really useful. I feel like I should know or learn how to do it the more "complicated" way, but your tool sounds like it could be very handy. I will give it a go.

Cheers,

Scott
 
Back
Top