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

mesh from csv

Messages
88
Hi,

i have a large ascii csv (lat,lon,altitude) which i convert to a geotiff with gdal_grid -l layername layername.vrt layername.tif

the csv (example, altitude in meter):
x,y,z
14.21989837,50.87816992,326.79
14.21989837,50.87817920,326.79
14.21989837,50.87818848,326.79
14.21989837,50.87819776,326.79
14.21989837,50.87820704,327.56


the layername.vrt has the following structure:

<OGRVRTDataSource>
<OGRVRTLayer name="layername">
<SrcDataSource>layername.csv</SrcDataSource>
<GeometryType>wkbPoint</GeometryType>
<LayerSRS>WGS84</LayerSRS>
<GeometryField encoding="PointFromColumns" x="x" y="y" z="z"/>
</OGRVRTLayer>
</OGRVRTDataSource>


the tiff is not readable by resample.exe, opened with QGIS and saved again as geotiff.
Now resample.exe takes it and compiles a bgl. But the bgl just creates a hole in the existing mesh, like the altitude is 0m, but the terrain altitude is 340m.

the inf file looks like this:
[Source]
Type = GeoTIFF
Layer = Elevation
SourceDir = "C:\SBuilderX313\Tools\Work\layername"
SourceFile = "layername.tif"
MinValidValue = 0

[Destination]
DestDir = "Output"
DestBaseFileName = "layername_Elevations"
DestFileType = BGL
LOD = Auto


Is there anything wrong with my conversion? How would you create a mesh from a csv file?

Thanks for any suggestions
 
Perhaps one of the folks here such as Holger, rhumbaflappy, or Arno, that are more familiar with the work-flow required within QGIS GUI (or the rather arcane syntax for GDAL in 'command mode') ...could help explain the way to use that GIS application environment to ensure your XYZ ASCII data is interpreted and output as "elevation" for the 3rd "Z" field in each of your lines (records). :scratchch


I instead use Global Mapper, and in that GIS application, when such sequential ASCII (CSV='Comma Separated Values') text XYZ data is imported, one is automatically prompted with a configuration dialog in which the 3rd ("Z") field is assigned to be interpreted as "Elevation" / "Altitude".

Once that is processed and displayed in the default color HillShader mode on screen in the Global Mapper workspace, one can simply export as 3D "Elevation" data and choose the GeoTIFF (32-Bit Floating Point) output file format option.

IIUC, you are on the right track, but need specific GIS commands sent so proper GDAL / OGRE GIS tasks are performed on a XYZ file. :)

GaryGB
 
Last edited:
Hi,

Did you check the geotiff file you made in qgis? Do you see the right elevation there? And which data type (int, float, etc.) is used to store the data?
 
Perhaps one of the folks here such as Holger, rhumbaflappy, or Arno, that are more familiar with the work-flow required within QGIS GUI (or the rather arcane syntax for GDAL in 'command mode') ...could help explain the way to use that GIS application environment to ensure your XYZ ASCII data is interpreted and output as "elevation" for the 3rd "Z" field in each of your lines (records). :scratchch


I instead use Global Mapper, and in that GIS application, when such sequential ASCII (CSV='Comma Separated Values') text XYZ data is imported, one is automatically prompted with a configuration dialog in which the 3rd ("Z") field is assigned to be interpreted as "Elevation" / "Altitude".

Once that is processed and displayed in the default color HillShader mode on screen in the Global Mapper workspace, one can simply export as 3D "Elevation" data and choose the GeoTIFF (32-Bit Floating Point) output file format option.

IIUC, you are on the right track, but need specific GIS commands sent so proper GDAL / OGRE GIS tasks are performed on a XYZ file. :)

GaryGB

Thanks Gary i will try global mapper.
 
Hi,

Did you check the geotiff file you made in qgis? Do you see the right elevation there? And which data type (int, float, etc.) is used to store the data?

Hi Arno, i checked the file with gdalinfo:

Driver: GTiff/GeoTIFF
Files: layername.tiff
Size is 256, 256
Coordinate System is:
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433],
AUTHORITY["EPSG","4326"]]
Origin = (14.220059400000000,50.878201720000000)
Pixel Size = (0.000004840781250,0.000002863750000)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 14.2200594, 50.8782017) ( 14d13'12.21"E, 50d52'41.53"N)
Lower Left ( 14.2200594, 50.8789348) ( 14d13'12.21"E, 50d52'44.17"N)
Upper Right ( 14.2212986, 50.8782017) ( 14d13'16.68"E, 50d52'41.53"N)
Lower Right ( 14.2212986, 50.8789348) ( 14d13'16.68"E, 50d52'44.17"N)
Center ( 14.2206790, 50.8785683) ( 14d13'14.44"E, 50d52'42.85"N)
Band 1 Block=256x4 Type=Float64, ColorInterp=Gray


The elevation in qgis looked right (~340m-380m).

Maybe some parameter is wrong or missing when i create the tiff using gdal_grid.
 
I would just try to add: SampleType = FLOAT64 to the source section of your INF file. I think by default it is assumed that the input data type is integer.
 
the mesh looks a little bit stretched. I used WGS84(EPSG:4326) projection inside the source data. Is FSX using the same or the WGS84 Pseudo Mercator(EPSG:3857)?

EDIT: just my mistake of retrieving the source data, now it is working
 
Hi terrain experts,

Please could someone point me in the right direction...i don't get it working. I tried global mapper, but the demo expired, and it is too expensive, so i tried to go only with GDAL. So far no problem, i use gdal_grid to create a geotiff from csv...here my problem starts:
which format i need to chose? I sometimes read resample.exe takes 16 bit integer, 32bit floating point...what do i need to use? After i produced the geotiff, resample tells me that pixel width and height must be greater then zero. I tried the tool GeoTiffToInf, but it tells me that the tiff has no geotiff-tags. The source file is a csv with "lat, long, elevation" data.

The output of gdal is as follows:

Code:
gdal_grid.exe -ot UINT16 -of GTiff -txe 13.90594 13.90629 -tye 48.9353 48.93552 -l dem dem.vrt dem.tif
0...10...20...30...40...50...60...70..
gdalinfo.exe dem.tif -stats
Driver: GTiff/GeoTIFF
Files: dem.tif
Size is 256, 256
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (13.905939999999999,48.935299999999998)
Pixel Size = (0.000014000000000,0.000008800000000)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  13.9059400,  48.9353000) ( 13d54'21.38"E, 48d56' 7.08"N)
Lower Left  (  13.9059400,  48.9355200) ( 13d54'21.38"E, 48d56' 7.87"N)
Upper Right (  13.9062900,  48.9353000) ( 13d54'22.64"E, 48d56' 7.08"N)
Lower Right (  13.9062900,  48.9355200) ( 13d54'22.64"E, 48d56' 7.87"N)
Center      (  13.9061150,  48.9354100) ( 13d54'22.01"E, 48d56' 7.48"N)
Band 1 Block=265x265 Type=UInt16, ColorInterp=Gray
  Minimum=200.000, Maximum=201.000, Mean=200.741, StdDev=0.438
  Metadata:
    STATISTICS_MAXIMUM=201
    STATISTICS_MEAN=200.7408
    STATISTICS_MINIMUM=200
    STATISTICS_STDDEV=0.43819557277552


Has anyone a step by step guide to get csv->geotiff->bgl working with GDAL?

Thanks for any help!
 
Back
Top