XYZ file terrain modeling

Hello

I have a ASCII XYZ textfile of a specific terrain in Switzerland. To my understanding this is not more than a list of points.

Is there an add-on available that imports these points and makes a nice terrain model without edges / smoothed out of it?

I find the extension that import xyz points, however I did not find an extension that models a nice terrain model out of the xyz points provided.

Is this possible? How to?

Thanks for you help -

Thomas

I might be of some help. Can you share a little bit of the file? Just the first few dozen lines should be sufficient to get an idea of what might be involved.

If you already have the points in SketchUp the terrain could be model with TopoShaper plugin from Fredo6 (download from Sketchucation, free subscription). You can watch this video to learn how it works. TopoShaper video

Hello Jimhami42

Here you find what is in the file. To be said that there are many more lines. The z = -9999 lines do not make any sense to me, so I guess the useful data starts where xyz have a meaningful vlaue.

2721553.0 1255863.0 -9999
2721555.0 1255863.0 -9999
2721557.0 1255863.0 -9999
2721559.0 1255863.0 -9999
2721561.0 1255863.0 -9999
2721563.0 1255863.0 -9999
2721565.0 1255863.0 -9999
2721567.0 1255863.0 -9999
2721569.0 1255863.0 -9999
2721571.0 1255863.0 -9999
2721573.0 1255863.0 -9999
2721575.0 1255863.0 570.2751
2721577.0 1255863.0 570.3503
2721579.0 1255863.0 570.433
2721581.0 1255863.0 570.4958
2721583.0 1255863.0 570.4926
2721585.0 1255863.0 570.4893
2721587.0 1255863.0 570.4612
2721589.0 1255863.0 570.4128
2721591.0 1255863.0 570.3645
2721593.0 1255863.0 570.3162
2721595.0 1255863.0 570.2678
2721597.0 1255863.0 570.2195
2721599.0 1255863.0 570.1492
2721601.0 1255863.0 570.1753
2721603.0 1255863.0 570.192
2721605.0 1255863.0 570.2056
2721607.0 1255863.0 570.1819
2721609.0 1255863.0 570.1918
2721611.0 1255863.0 570.1631

Thank you for you help -

Thomas

@thomas.engel

Here’s an example import of the above data using construction points. I usually start with those to get a feel for the data layout (grid, rows, etc.). Once that’s determined, it’s usually pretty easy to come up with a polygon scheme to connect the dots.

This very simplistic plugin can be downloaded from here:

https://sites.google.com/site/spirixcode/code/jimhami42_import_points.brz

Note that it expects a text file (i.e., filename ends in .txt). Let me know what you end up with. BTW, the -9999 is a normal method of indicating that no height data was collected. After the fact, it’s easy enough to delete these in a side view.

1 Like

Yes, you can easy create 3-D surface from this type of data. I did this for my Master’s degree. I was creating very large 3-D surface (over 6 million data points). I used Trimble Business Center, but you can use Meshlab or Surfer.

Dear all

I got to the following issues:

  1. I have a .xyz file with data structure provided that I can not import to SketchUp - I can not select in SketchUp pro .xyz as filetype.
  2. I did not manage to get the tools indicated to run - either they were for Sketch Up 2016 (I have 2017) or I was not able to install or open them (maybe also because of versioning?).

However, as indicated by Snowman, I believe this is a basic problem. So I kindly ask to specifiy the procedure that needs to be undertaken to make out of a datapoints in a .xyz file a terrain model. Also I am ready to buy an affordable software if this helps. Please advise. Thank you very much.

Best regards, Thomas

The .xyz file needs to be renamed as a text file (i.e., ending in .txt). The plugin I made simply reads the ASCII data (as you indicated is in the file) and creates construction points. Once these are imported into SketchUp, you can see how they are laid out. In this case, it appears that they are 14 units apart in X and (guessing here) likely to be composed of multiple “runs” in X. The next step is modifying the import plugin to create triangles with the points which then become surfaces.

Here’s an example I made in SketchUp Make from US Geological Survey data:

2 Likes

Dear jimhami42

I can not use / run the plugin you provided in earlier post. Can you provide an alternative way with details on how about to proceed. Is it an addon that needs to be installed within SketchUp or a tool outside of SketchUp.

However, I believe I have the .txt ready.

Thank you

Thomas

Here my files in txt if this is of help: I found out that easier than converting is just, as indicated, make windows 10 show the extension and just change these to .txt

https://drive.google.com/open?id=0B359nqbEg_T-Sm1mWUV4SkFyYTg

Sorry, missed to put the link.

Hi Thomas

Do you really need is much data, to cover is much area? You are looking at over 10.3 million data points.

When I was building my model for my Master’s, I was dealing with about 5 million data points. The SketchUp file was about 1.8 GB and SketchUp was using around 8-10 GB of RAM.

To work with is amount of data you will need something professional like 64-bits ArcGIS or you will need to filter your data down a little bit, to make it smaller.

I ignored everything below zero level and ended up with 579,043 points. As a point cloud represented by a tiny plus sign, they appear quite dense in plan view until closer inspection:

The SKP file is about 37MB. This short GIF shows the result (so far):

[This was from the smaller Rickenbach file]

Jimhami42 -

This looks awesome! To my information it is the most accurate alti-data you can currently get in Switzerland - therefrom might come the number of points.

A) Can you please teach me how you achieved that (meaning how you imported the data) and how we can make a terrain out of it (combine the dots with polygons)?

B) Would it be helpful if I can locate the area needed to just a small area?

C) Why are dots that are of no value (I guess all the -9999) in the data set - how can this happen, what is the rationale for this?

D) I have also purchased the buildings of this area - also something very new and exact, even for Swiss measures - however I do not understand how the houses can then be put on a terrain that has different altitudes - do I have to think of this like a differen layer or how does this work?

Thank you very much -

Thomas

B) Yes, it can be, especially for the larger file. I generated a 260 ha 0.5-2m DEM and is was pushing SketchUp to the max. How large of an area are you looking at? Also can also reduce the resolution of the dataset.

C) This is because the data is rasterized digital elevation model and not a Triangulated irregular network.

I imagine the geodetic datum is CH1903 or CH1903+?

Here is the reduced file for the area I am looking at (just the smaller rickenbach file - I am working on reducing the wil file, however this is more complementary):

https://drive.google.com/file/d/0B359nqbEg_T-eDd3OGJyanc4TFk/view?usp=sharing

To the question whether its CH1903 or 1903+: Yes, correct, the exact description of the data is as follows: Dateiformat: ASCII XYZ textfile, Koordinatensystem: CH1903+ LV95 / LN02, Download, Nutzungsdauer: unbefristet

Here you find the “wil” file:

https://drive.google.com/open?id=0B359nqbEg_T-ZVF2M29aS3VVSGs

I need to reduce that file:

  1. take out all lines with -9999 in the Z column as this is not relevant data
  2. reduce / filter so I only have the data points in the field from 2720920,1256200 to 2721920,1257100.
  3. the remaining data points need to be merged with the rickenbach file (where I also filtered for all points in the field 2720920,1256200 to 2721920,1257100).

I tried to open the wil file in excel: did not work - to many lines
I tried to filter the data with EmEditor (text-file editor): did not work, was not able to filter as intended
I tried to import the data to an access database and filter: did not achieve, however I am sure this would work out.

What is an easy way to reduce the amount of data in the wil file considering 1. to 3. above?

Thanks

I have uploaded the DEM to my 3D Warehouse page :satellite:

https://3dwarehouse.sketchup.com/model.html?id=35083a00-cb69-4c58-a7b9-b41411734930

1 Like

Very nice DEM, very precise. How did you achieve this? Please explain. Thank you.

@thomas.engel

I had to put this aside for a while … here’s what I get if I import the datum points and connect the dots with triangles:

This was taken from the wil file with the clipping values you indicated above.

How? I first wrote a simple import / export routine to create a new file with only the points within the clipping area. These ended up creating a grid that was 500 x 442 points. I next wrote a simple import to read the new file and create triangles in the model.

To give an idea of how little is needed to do this, the bulk of the routine is here:

  def import_points_c()
    model = Sketchup.active_model
    filename = UI.openpanel("Select TXT File", "~", "Text Files|*.txt;||")
    data = File.open(filename,"r")
    t = data.gets # skips first line (X Y Z)
    node = []
    for j in 0...442 do
      pts = []
      for i in 0...500 do
        t = data.gets
        x,y,z = t.chomp.split(' ')
        pts.push(Geom::Point3d.new(x.to_f,y.to_f,z.to_f))
      end
      node.push(pts)
    end
    data.close
    group = model.active_entities.add_group
    mesh = Geom::PolygonMesh.new()
    for i in 0...441 do
      for j in 0...499 do
        mesh.add_polygon(node[i][j],node[i+1][j],node[i][j+1])
        mesh.add_polygon(node[i][j+1],node[i+1][j],node[i+1][j+1])
      end
    end
    group.entities.fill_from_mesh(mesh,1,0)
  end
1 Like