SC4 Devotion Forum Archives

Sim City 4 Devotion Tools => Tools - General Discussion => Topic started by: kbieniu7 on November 13, 2015, 06:03:08 AM

Title: Point cloud - height map (.sc4m to .txt)
Post by: kbieniu7 on November 13, 2015, 06:03:08 AM
Hello!

Does anybody of you, smart guys, know if there is any way to get a point cloud with coordinates from a city tile?  :) I mean, to get a .txt file with x, y, z coordinates for each point of a tile, for exampe:

x         y               z
89,2   303,5           560,2
109,9   304,5           625,5
38,5   299,6           564,1
7,9   300,7           440,7
87,3   302,8         574,5
8,4   300,5      570,1
85,4   302,3           614,2
47,8   301,9           675,4
2,5   301,6           721,3
56,7   304,3           693,5
111,4   304,5           700,8

Seems like an engineer's geek. I play a bit with terraforming and railway designing now. I thought about exporting my in-game terrain into AutoCad and create a 3D surface of a part of a region. The points, that I pasted as an example, I've collected them with "terrainquery" in-game tool, but it's not possible to measure bigger area manually.

Thanks in advance for any ideas and advices ;)
Title: Re: Point cloud - height map (.sc4m to .txt)
Post by: c.p. on November 13, 2015, 12:25:43 PM
With some extra software you can do it.  Here is one way.

You will need:
SC4Mapper by Wouanagain (on the LEX)
Quantum GIS software (it's a pretty big program, but it's free).  Available here:
http://www.qgis.org


First, load your region in SC4Mapper then export as a 16-bit Png.

Open Quantum GIS
Go to Raster->Conversion->Translate on the menu

At Input Layer , select the .png you saved in SC4Mapper
At Output Layer, select the ASCII Gridded XYZ format and enter a file name
Hit OK and wait for it to finish

Then, open the .xyz file in a text editor (such as notepad) and run a search and replace, to replace the funky special character that separates each point, with a carriage return, (to get it in the format you show above.)

The result will be all the points of the grid, but they will be at a very distorted scale.  Once you get the points into autocad, you will have to scale them 16x on the x and y axis and 0.1x or 0.2x (I forget which) on the z axis.

It may be possible to do the rescaling in Quantum GIS before you export, but I don't know enough about the program to do it myself.

Hope that helps :)
Title: Re: Point cloud - height map (.sc4m to .txt)
Post by: kbieniu7 on December 02, 2015, 01:33:42 PM
Hey!
Thanks a lot for your advices  :) I never used Quantum GIS before, seems I will need to take a look at it. I opened my region in sc4terraformer. However, as I export it to the grayscale the terrain shape is barely visible. Is there a way to scale the grayscale?

(https://www.sc4devotion.com/forums/proxy.php?request=http%3A%2F%2Fi443.photobucket.com%2Falbums%2Fqq160%2Fkbieniu7%2Fmap_TF_exported_16.png&hash=0780994cc7d2aa775673859bce371f8a408c380f)
Title: Re: Point cloud - height map (.sc4m to .txt)
Post by: c.p. on December 05, 2015, 09:39:51 AM
You can use the "Compressor" in "Global Tools" in sc4terraformer to exaggerate the vertical relief before you export the 16-bit grayscale.  (Make sure to do this on a copy of the region you don't want to keep.)  This will distort the vertical relief of your points even more than what I mentioned above.  A 16-bit grayscale will be much, much darker than an 8-bit grayscale, but is much, much better quality.
Title: Re: Point cloud - height map (.sc4m to .txt)
Post by: kbieniu7 on December 05, 2015, 03:39:40 PM
Ok, thanks! I'll take a look at it, if I have more time later. Thank you very much for the help!  :)