My georeferenced terrains mismatch

Started by Roberts, March 15, 2015, 02:53:42 PM

Previous topic - Next topic

Roberts

Hi!

I have some terrainfiles from the Swedish land survey which I´m using as base for my terrains in TG. Originally they are ASC-files from laserscans which I have imported and then exported from the free program VTBuilder. I exported them from there as Geotiffs.

They open fine in TG (using heightfield load) and the correct corner coordinates show up in TG´s "georeference" window (see picture). As you can see the south-east coordinate of the left (western terrain) is the same as the south-west coordinate of the right (eastern terrain). And the north-east coordinate of the left (western terrain) is the same as the north-west coordinate of the right (eastern terrain). Therefore the corners should match and occupie the same spot. But they don´t...

Does anyone have any idea what the problem might be? Why aren´t the corners at the same spot? And why is there a mismatch between the different heightfields where they meet? These are two adjacent chunks of real terrain which show up fine in VTBuilder, but are misaligned in TG.

To be clear I should also mention that there is no fractal detail added and border blending of the heightfields are set to zero in TG. So they really should line up seamlessly, shouldn´t they?

Any help is much appreciated!

Regards / Robert

PS The planets apex in TG is set to the western terrains south-west corner´s coordinates. DS
[attach=1]
[attach=2]

Oshyan

I can't think of a reason it would be misaligned off the top of my head. But since this is not standard, widely available data, I think the first thing to verify is that loading the data in another app works as expected *after export*. If you can load it back into VTBuilder (as GeoTIFF) and it aligns correctly, that at least tells the data should be fine. Ideally you could load it into another app entirely, so we know it's not something going on with VTBuilder's export process, for example. Perhaps you've already verified the GeoTIFF re-load in VTBuilder?

- Oshyan

Roberts

Thanks for the suggestion, Oshyan.

I loaded the geotiffs back in VTBuilder and it looks like below. They seem correctly aligned to me. The info in VTBuilder of each tile´s corners also shows that they share the same coordinates where they meet on the two corners. So that seems correct.

As for loading in another app I haven´t tried it. Any suggestions on free apps I can use? 3Dem for example won´t let you load more than one geotiff at a time, so it´s hard to check for mismatching there.

/Robert

bigben

#3
That twigged me to one possibility... Try changing the projection in VTBuilder from UTM to lat/long and then export.  That far north there's going to be some big differences in projection if it's only using the corners for placement and I'm not sure if TG reprojects UTM

Roberts

OK I will try changing to a different projection in VTBuilder and then export again. Admittedly, I´m no cartographer, but shouldn´t the same coordinates always mean the same position on the planet?  TG can read the files and says that two different terrains share corner coordinates, but the corners are still in different positions... At least on TG´s planet. That´s what´s puzzling to me.

Anyway, I will try different projections and see if it works better.

Thanks for your suggestions!

/Robert


bigben

TG uses a spherical projection (ie. lat/long or geographic projection)  Suffice to say that the relationship is not one where a rectangle in UTM is a rectangle in lat/long (http://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system#From_UTM_coordinates_.28E.2C_N.2C_Zone.2C_Hemi.29_to_latitude.2C_longitude_.28.CF.86.2C_.CE.BB.29)

From the DEM file you get the coordinates of the corners, but when you reproject UTM to lat/long, the bottom right corner of the image won't necessarily be the most southerly point of the reprojected image, thus causing the differences that you're seeing. 

Roberts

#6
Thank you very much for the help bigben!

It seems to be working now when I reprojected the DEMs to geographic instead of UTM. See picture below. The only thing to be aware of is that when I reproject from UTM to geographic, I need to have the adjacent DEMs open so that I don´t get strange borders (you can tell by the picture that I haven´t done that properly yet, you can see a strange "wall/trench" especially on the DEM on the right). But that´s because how VTBuilder works, not TG. I guess it´s similar even if you use another program to prepare your DEMs for TG.

What I initially thought was that TG would itself reproject the terrains to what TG needs, since the corner coordinates are readable by TG in the geotiff. But that is obviously not the case. Changing to geographic in VTBuilder and then export as geotiff worked. So great many thanks:-)

Regards

Robert

bigben

Yes, it's an antialiasing problem.  If you rotate an image in Photoshop for example, the edge pixels will be blended with the background colour.  With GIS data, the edge pixels are blended with adjacent altitudes when transforming, but if there are none then they blend with 0, thus lowering the edge terrain.  I always load my global DEM first before creating high res DEMs for TG so any gaps are seamlessly filled in

For those using QGIS, you would want to merge the DEMs first and then change the projection.  I'll have a look at VTBuilder as it sounds like it has better workflows for this sort of thing than QGIS.