XYZ file terrain modeling


#61

Me too I am off for earning duties Mo - Fr and am not able to follow up regularly - your help is highly appreciated, no worries. I am impressed by the possibilities of replicating the real world in virtual space - this is really fascinating for me.

I believe it would make sense to move the model to the origin, even more when SU is having problems with models far away from origin. But how can I make a controlled move: I would need to deduct all X-values by e.g. 2720900 and all Y values by e.g. 1256180 and all Z values by e.g. 480?

And how can I define in the Mühle-model two specific points in order I can import the model to the created terrain?

And I have a basic problem of understanding of the buildings data - here you find the data as I purchased it:

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

There is always a models folder, a .kml file and a .log file. I do not understand how these 3 elements interplay with each other. Reading your comment precisely I would need to zip the models folder and the .kml file and just rename the resulting zip to .kmz, correct?


#62

From what I can determine, SketchUp will only allow one DAE file per KML file. Also, each KML file has a different offset in latitude and longitude for each associated DAE file. Your KMZ files have multiple offsets and multiple models. I came up with an import plugin that still needs some tweaking. However, it allowed me to import your three KML files and their associated models:

That’s quite the virtual town you’re building there :slight_smile:

I will post the plugin after I’ve finished playing with it some more.


#63

I used the offsets of 2720920,1256200 to 2721920,1257200 for the import parameters for the XYZ file(s). Since the X/Y data is only odd numbers, this resulted in the lower left corner being 2720921,1256201 and the upper right corner being 2721919,1257199. I moved the terrain west 2720920 meters and south 1256200 meters. To import the buildings, I copied your three building folders to my computer and then ran the plugin on each of the three KML files separately.

About the plugin … this is the data used (model units set to meters):

The Latitude and Longitude is the location of the SketchUp origin in degrees. The Lat and Long Scales are used to convert the decimal degree offsets contained in the KML files to meters (expressed as meters/degree). These two numbers determine the relative placement of the buildings from the origin. The buildings themselves use meters and aren’t affected by these values (just their location).

The buildings are imported as triangular faces that are created in the node order as written to the file. Some of them are reversed, some are not. Each building is placed in a group and named with the folder/model name for reference.

The plugin can be found here: https://sites.google.com/site/spirixcode/code/thomas_kml_importer.rbz

Note: the plugin requires the REXML Ruby module which you might need to install separately (i.e., outside of SketchUp). Let me know if it works for you.

[added] A note about the vertical heights. The church steeple, for example, has its base at an altitude of 549.484 meters. However, the XYZ terrain at that location has 552.9752 as the elevation. Either the buildings will need to be raised about 3 meters or the terrain lowered by the same amount.


#64

jimhami42 - this looks awesome! - I have 3 questions for better understanding:

How did you move the terrain west 2720920 meters and south 1256200 meters?
How exactly do you come to Latitude and Longitude values and do they need to be in degrees?
How exactly do you come to Lat and Long Scale?

Also after reading several times I do not yet understand the basic mechanic of your new plugin. Thanks for your help.


#65

@thomas.engel - My explanation was somewhat confusing. I’ll try to clarify it.

I’m not sure what boundaries you’ve finally chosen, so I tried to explain everything using the 2720920,1256200 to 2721920,1257200 corners that you mentioned a while back. I used these numbers to merge the two XYZ files into a 499 x 499 grid (1000m x 1000m with gridpoint every two meters). As you know, this created the grid in SketchUp at 2720921m in X and 1256201 in Y.

I selected the grid and used the move tool to move it a few meters to the left (West or -X) and then immediately typed 2720920 and hit enter. This jumped it in X the distance required. Then I moved it a few meters down (South or -Y) and typed in 1256200 and hit enter. This positioned the lower left corner of the terrain just off the origin at 1m in X and 1m in Y.

Your XYZ data is in CH1903+ x/y coordinates which is in meters. The KML locations for each building are expressed in degrees latitude and longitude. I used this converter to calculate the origin (CH1903+ 2720920, 1256200) to degrees:

https://epsg.io/transform#s_srs=2056&t_srs=4326

This gave me:

These are the values I present when you run the plugin. This is the origin of your SketchUp model in degrees. They are subtracted from the KML locations (also in degrees) and then multiplied by the lat/long scale factors to locate the DAE files in the model.

As you probably know, the number of meters in a degree varies with your location. At the equator, traveling 0.01 degree north/south is about the same distance as east/west travel. However, as you move north or south away from the equator, the distance you travel east/west becomes shorter and shorter while the north/south distances remain about the same. I used this calculator to come up with a scale factor for north/south and one for east/west measurements:

http://msi.nga.mil/MSISiteContent/StaticFiles/Calculators/degree.html

Using these initial values resulted in the buildings being in the right neighborhood, but clearly out of place. After a couple of iterations, I settled on the values in the plugin as a suitable “fudge” factor. You can tweak these to control how accurately the KML import overlays your terrain import.


#66

Thanks for your details, I am testing, evaluating and working on it. As I am in need of really precise placement of the buildings, I also tried the following new approach: I pulled data of a couple of houses as .dxf, the import was very easy, see here:

When by importing into SU I opt for “Preserve drawin origin” I believe the buildings are precisely and correctly placed without any further manipulation. My rationale is as follows: The models already have the correct XYZ values, otherwise they would not fit to the terrain built from the XYZ’s.

Do you believe this could also work out and bring a correct and precise solution?

I will now pull the data that correspond to the terrain model and check how this look.

Next step once we can confirm this works out correctly would be to put in the Mühle model with two correctly tagged XYZ points - how could I achieve this?

Also, do you know how I can achieve that the houses are just white and not red and yellow as in your model?

Thank you - Thomas


#67

I selected two buildings on opposite corners of the terrain:

If you examine the associated KML file for the top left one, you find this for the location info:

<Model>
  <altitudeMode>absolute</altitudeMode>
  <Location>
    <longitude>9.04218949792811</longitude>
    <latitude>47.4529963144249</latitude>
    <altitude>0</altitude>
  </Location>
  <Link>
    <href>models/model_18.dae</href>
  </Link>
</Model>

Similarly, for the lower right building:

<Model>
  <altitudeMode>absolute</altitudeMode>
  <Location>
    <longitude>9.05345697243103</longitude>
    <latitude>47.4469529873855</latitude>
    <altitude>0</altitude>
  </Location>
  <Link>
    <href>models/model_319.dae</href>
  </Link>
</Model>

You asked earlier why I used degrees instead of meters to position the import … this is why. The buildings in the KMZ import are located in degrees and then the DAE file uses dimensional meters about that location. If you can correlate the long/lat locations to the center of these buildings, you can adjust the terrain to fit exactly.


#68

I used Control-A to select all of the groups and then used the paint bucket to color them all at once.


#69

OK, after some time off I picked up. Thanks for your guidance. With the new dxf files I get very accurate resultes, see here:

So I achieved the basic step of building terrain and putting the buildings accurately in. YEAH! THANKS EVERYONE WHO CONTRIBUTED.

Going further, I would like to get a solution for the blurry effect mistake, see here. Is there a way / settings to be made I can avoid this?

Thank you, Thomas


#70

Is your model very far from the origin? To me those look like opengl artifacts.


#71

Moved it to the origin. Much better now.


#72

Here a printscreen of my final model on a specific recangle terrain, special cheers to jimhami42 and all the others, very happy thank you very much much.

I want to render that model, put trees etc. in and walk around outside and in the building in normal (on PC screen), in VR or AR and get hopefully a realistic experience.

I tried Lumion. No success importing the model and I dont know whether its due my pc power or because its just not possible to import model of that size (file size ca. 86 MB).

Are there any suggestions what the best tool currently is on the market to render models like this and make a beautiful walk-through experience possible?

The solution should work stand alone resp. in the browser so another person does not need to install specific software on its computer to walk through the model.

Any suggestions welcome. Thank you.


#73

Hi @thomas.engel , i’ve been following the thread silently and glad the workflow ended good enough.

For your walk-through rendering, you may check Twilight Renderer , it’s fairly cheaper among others. Here is a tutorial on animation and it has a Terrain Tool which might come in handy.

Back to the very first post: May i ask how did you get such text/information?


#74

I got this data from Swiss Landestopographie in Bern. Sending comes by post on USB stick. They dont do online to what I know.


#75

Thanks for the info.
Actually i’m curious about the process of making that text file from the data. Generally municipalities here in my country provides .dwg files with accurate height info but on a 2d plane. And i have no idea how to grab those numbers in an automated way to a text file. Do you have a clue on this @jimhami42 ?


#76

I once made an AutoLisp routine that takes the height texts in a traditional 2D DWG survey and draws a vertical line corresponding to the height value at the location of each. When imported into SketchUp, the sandbox from contours tool can then be used to place a surface on top.


#77

So how do you go from Meshlab to SketchUp?


#78

The term I see most often to generically represent terrain data is “TIN” (Triangulated Irregular Network). The typical data provided in DWG format is analogous to contour maps and consists of planar loops and boundaries. This is more properly referred to as a “DTM” (Digital Terrain Model). The XYZ format in this thread is a rasterized format that is more properly called a “DEM” (Digital Elevation Model). Conversions between either format involve some sort of interpolations along the way which may introduce undesired anomalies. @NZSnowman can probably shed some light on the issues involved in doing this.

It would be best to obtain DEM files if they are available. You can obtain DEM files for North America in various resolutions from here:

https://viewer.nationalmap.gov/basic/ (look under Elevation Products (3DEP))


#79

Now having an accurate terrain with accurate built environment:

A) still, I am searching for a good stand alone solution (meaning no additional software needs to be installed on other peoples PC I want to show the model to) to render and walk in the model. Any more suggestions? Why Lumion is not working is under review.

B) When I in SU turn View/Shadows on after manually geo-locating to the correct village. My model is standard northed (do you call that like this?, meaning y-axes is north). Does SU automatically assume y-axes is north or do I have to define this somewhere? Is my rationale correct that manually geo-locating is precise enough: It doesn matter when the real place is e.g. a couple of hundred meters more west as this wont make a difference on the shadows or shuold I take the midpoint of my model?

C) Over the weekend I did think of how else I could use the model besides walk-arounds in the model / renderings and shadows. That brought me to an interesting subject I touched couple of months ago. For Switzerland, there are isophonic maps available for day and night, see here the night version (as night is more problematic to meet required max levels in construction projects):

The legend to read the graphic here:

So this map for sure is way too complex for easy processing in my model. However, I did come to the idea, that I can place something like a noise-point or source and then be able to see how this is effective to different places in my model (to answer the question: what are the resulting noise levels I have?). I know that sound spreads spehrical / ball shaped. Is there an easy solution for that problem?

Just a side-note: Glad to see jimhami is still around :slight_smile:


#80

Thanks for the inputs guys.

That sounds fair enough, i’ll look more into AutoLisp functions.

Could you clarify what is meant by ‘rasterised’ here? May i say DTM is ‘vectorised’ and more accurate then? (that doesn’t sound quite right)

I generally use this site to search: https://earthexplorer.usgs.gov/ , because it has global data from various sources. And i look for ASTER Global DEM or SRTM 1 Arc-Second Global but their resolution (~30 meter) is not enough sometimes, that’s why i try some alternatives. (or is that the highest we can get at this point?)

Best way could be exporting a 3D pdf (it opens normally in Adobe Reader). And that file includes scenes, layers and other useful stuff to tweak. Check this 3D pdf exporter from Simlab. Here are some 3D pdf examples available for download.

Also it’s possible to export WebGL with their SimLab-Composer (send via zip to be viewed on a browser locally or embed to your website and share the link). Check their website for more info.