Import governmental terrain data (DEM/DGM) and work with UTM32 coordinates

Hi community,

I’m trying to get creative planning and building a house. I’m still quite new to Sketchup and am trying to find my way through. I experimented a bit with the location and terrain import that’s built in but would love to use some more accurate and detailled data.

I do have some data from the government which is in 1 meter resolution and looks like this:

714229 5322511 561.22
714230 5322511 560.91
714231 5322511 560.64
714232 5322511 560.35
714233 5322511 559.95
714234 5322511 559.62
714235 5322511 559.27
714236 5322511 558.90
714237 5322511 558.62
714238 5322511 558.20
714239 5322511 557.88
714240 5322511 557.57
714241 5322511 557.25
714242 5322511 556.77
714243 5322511 556.48

The coordinates should be in UTM32 format, height (3rd column) is in meters above sea level.

Is there any chance to import them into Sketchup? I thought the toposhaper addon might possibly work to create surfaces from it.

Also it would be interesting if Sketchup would be able to line up the data with for example satelite imagery or even my own images (drone images). But that’s maybe the second iteration of compexity then :wink:

At first it would be great to be able to import and work with the terrain data.

Here’s a full set of sample data if someones wants to play with it: Dropbox-Link (8MB zip file, 46mb txt unpacked)

Thanks anyone for helping!

Another interesting task, recently was another in which someone wanted to get a 3D mesh from a LAS file (Lidar). Follow that discussion to understand the steps you need to take.

STEPS:

  • First of all, I imported half of your data (ie first 1,000,000 points) into a Google Sheets file. I saved them in a CSV file, with commas as a separator between the 3 numbers.

  • In CloudCompare I imported the CSV file, generated the 3D surface and saved as a PLY file.

  • In MeshLab I simplified the 3D mesh from PLY file, reducing it from 2,000,000 faces to 50,000 and I exported as a OBJ file.

  • In SketchUp, I used Universal Importer and imported the OBJ file, without reducing the number of faces.


Your txt file has 2,000,000 points, probably you could use the TIG plugin Coords-Tag from Datum to import them and create points in SketchUp, which you can then use with TopoShaper to generate a 3D surface, but I think you would need a very powerful computer for that.

2 Likes

First of all thanks a ton, @mihai.s - highly appreciated.

And then sorry for the huge test data - I just realized that the real data I have purchased is way smaller than the test data - it’s “only” 2,7MBs vs. 46MBs. It’s only a bit over 100k data points.

I will definitely try to find some time the coming weekend to test this out. I need to check cloud compare and Meshlab. I will also give the other way a try. As the data is much smaller it might work - who knows.

1 Like

So I’ve done some first playaround yesterday but didn’t really come forward yet. All the possibilities with Cloud compare and Meshlab look fine to me in terms of 3d model creation but if I didn’t miss something totally, there’s not really a good way to lineup the data in sketchup later. But that may also be me missing something totally to my lack of experience.

Anyways… I found out that working with over 100k data points for precision still is a bit tedious at least for now. Also the UTM format isn’t something that Sketchup plays well with. So i quickly hacked myself a python script to narrow down the area a bit more and also conver the coordinates to WGS84 format.

Here’s what I came up with - maybe someone else can take use of it.

import csv, utm

# Specify the min/max values in UTM coordinates. This area will be kept and exported after conversion to WGS84
lat_min = 682417
lat_max = 682553
long_min = 5512815
long_max = 5512931
utm_zone_number = 32
utm_zone_letter = 'U'

with open('dgm-data-raw.txt', newline='') as csvfile:
    count = 0
    rawdata = csv.reader(csvfile, delimiter=' ')
    export_data = []
    for row in rawdata:
        count = count + 1
        utm_lat = int(row[0])
        utm_long = int(row[1])
        height = float(row[2])
        if (lat_min >= utm_lat <= lat_max) and (long_min >= utm_long <= long_max):
            wgs_lat, wgs_long = utm.to_latlon(utm_lat, utm_long, utm_zone_number, utm_zone_letter)
            export_data.append([wgs_lat, wgs_long, height])

    with open('filtered_export.csv', 'w', newline='') as file:
        writer = csv.writer(file)
        writer.writerows(export_data)

Need the utm module installed first but should easily be doable (pip install utm). The rest should hopefully be self explanatory.

That way I was able to narrow it down to roughly 8k data points. I think this might still be too much for the Coords-Tag from Datum plugin (which is really great for other stuff) and also creation with Topo Shaper seems to be a bit tricky too but probably 8k is already a better data size to work with.

Any further input is highly appreciated.

1 Like