Terrain min & max height on import

06-10-2014 12:21 PM
New Contributor
When importing a GeoTIFF heightmap with world file in the normal manner CE detects and assigns the min and max elevations quite well, however using addAttributeLayer in Python and pointing to the same terrain tile the min & max defaults to 0, 100 no matter what I've tried.

For instance, on a terrain tile imported the regular way you get the line:
attr elevation = map_01(brightness, 0.002005958, 5.0019827) + elevationDelta

That 0.002005958, 5.0019827 is what we're after. Is there any way for this to be populated correctly using Python? I hope so, we have a lot of tiles :o
Tags (3)
0 Kudos
3 Replies
Frequent Contributor II
dude, almost got me nervous there ... :)

but it's working here.

make sure you use CE2014 and check the 'useGeoRef' parameter to be true

Example code:
tex = "/maps/mySatellitePic.jpg"
elev = "maps/myElevationMap.tif"    

l = ce.addAttributeLayer('Terrain', tex, elev, True)

But please note that usually, only 1 terrain is supported per scene. Are you collecting the tiles in 1 scene ?

Lemme know ..

0 Kudos
New Contributor
Hi yes I do use the useGeoRef parameter and am using 2014. I zipped up a tile to test and PM'ed a link to you, it comes in OK with normal right-click Import method but min/max height go to 0/100 when using the script:

from scripting import *

# get a CityEngine instance
ce = CE()

def importTerrains():
    l = ce.addAttributeLayer('Terrain', "pathAerial/0000_0001.tif", "pathDEM/0000_0001.tif", True)

if __name__ == '__main__':

Thanks for looking!
0 Kudos
Frequent Contributor II
Hi !

Thanks for the data. I was able to reproduce the issue here on your data. Seems to be a bug.

We'll have a look into this.

As a workaround, please use these methods to edit the resulting elevation range that is defined in the Terrain�??s layer attributes.

Just make a list with all min/max values, then get/edit/set that value with python.

I�??m not sure how many tiles you have to process, but maybe try to get all in a text file, which you can parse with python in the process.

0 Kudos