Select to view content in your preferred language

Terrain min & max height on import

722
3
06-10-2014 12:21 PM
ToddHeckaman
Deactivated User
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 😮
Tags (3)
0 Kudos
3 Replies
MatthiasBuehler1
Deactivated User
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 ..

matt
0 Kudos
ToddHeckaman
Deactivated User
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__':
    importTerrains()
    pass


Thanks for looking!
0 Kudos
MatthiasBuehler1
Deactivated User
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.
getLayerAttributes()
setLayerAttributes()

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.


matt
0 Kudos