Community
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Tree heights from attributes

Tree heights from attributes

When using a point data file with height attributes for trees, it is not possible to load these and apply tree styles.

For buildings you can define the Roof Top height out of an Attribute.

It would be great to have the same feature for trees? For example get heights and optionally x and y scale from attributes.

 

 

5 Comments
ramesh_sridharan
Autodesk

Karsten, can you send me a sample data file to check it out? Thanks.

John_DeLeeuw
Advisor

@Karsten.Saenger, in the Table tab of your Data Source, you can set the height attribute in the Scale Z value for your trees. You can also set the Width attribute for X and Y scales.

 

2017-03-17_15-09-09.jpg

Karsten.Saenger
Autodesk Support

Hi @John_DeLeeuw

 

you are correct, but this is a scale factor. The goal ist to input absolute heights.
If you import the point file as trees they come up with height 5.5x . If you set the heights interactively the tress are also scaled in X and Y.

Have a look at this screencast – it’s the workaround: http://autode.sk/2n2WsQP

 

The “Height” attribute in the Shape file is the absolute height of a tree in meter.

The goal is not to “scale” the tree, because there is no scale factor. The idea is to get the possibility to use an attribute for the tree height (i.e. 10 meter) and the X and Y scale factor is applied automatically – same as shown in the video.

 

By the way – a workaround could be to calculate scale factors for X, Y, Z and add these to the shape attributes.

But this only works it the default tree height is always 5.592 m?

 

Cheers,

Karsten

John_DeLeeuw
Advisor

@Karsten.Saenger, I agree the scaling values also stretch the (basic) tree. If the basic tree is already 5.592 meters in height you can always use the formula Scale Z/5.592 to get the actual absolute height from your shape file.

 

The only way this can be accomplished correctly without scaling and deforming issues, would be parametric trees, just like the buildings are.

roskirko
Collaborator

Karsten:

Here the .js file Autodesk helped me write to read a text file output from a GPS system so that Infraworks can show the height of trees precisely as well as having a tooltip with the species data.

 

// global variables

var db = app.ActiveModelDb;
var dbWkt = app.ActiveModel.CoordSysWkt;
var classID = db.TableIndex("TREES");
var table = db.Table(classID);

var model = app.ActiveModel;
var Wkt = app.GetBestFittingUTM84ProjectionWkt(model.Boundary.BBox2d, dbWkt);

// var Wkt = "PROJCS[\"WGS_1984_UTM_Zone_17N\",GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.000,298.25722293,AUTHORITY[\"EPSG\",\"32617\"]],TOWGS84[],AUTHORITY[\"EPSG\",\"32617\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"32617\"]],UNIT[\"degree\",0.017453292519943295,AUTHORITY[\"EPSG\",\"32617\"]],AUTHORITY[\"EPSG\",\"32617\"]],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"32617\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",-81.00000000000000],PARAMETER[\"scale_factor\",1],PARAMETER[\"false_easting\",0],PARAMETER[\"false_northing\",-5000000],AUTHORITY[\"EPSG\",\"32617\"]]";

table.BeginWriteBatch();
var feature = table.GetWriteRow();

var TreeAdd = function (East, North, Elev, Type, Species, Height) {

var pointJSON = {
"type" : "Point",
"coordinates" : [East, North, Elev]
};
var geom = new adsk.Geometry(pointJSON);
geom = geom.Reproject(Wkt, dbWkt);
//var point = new adsk.Geometry(pointJSON);

//var pos = new adsk.Vec3d(East, North, Elev); // error : line: 20 : ReferenceError: Can't find variable: alx

//var geom = new fdo.Geometry(pos);
//geom = geom.Reproject(Wkt, dbWkt);

feature.GEOMETRY = geom;
feature.TOOLTIP = Species;
feature.DESCRIPTION = Species;
feature.GUID = app.createGuid();

switch (Type) {
case "Conifer":
feature.RULE_STYLE = "3D Model/Vegetation/Pinus Pinaster";
feature.MODEL_SCALE_X = Height/4.72;
feature.MODEL_SCALE_Y = Height/4.72;
feature.MODEL_SCALE_Z = Height/4.72;
break;

case "Decid":
feature.RULE_STYLE = "3D Model/Vegetation/Quercus Robur";
feature.MODEL_SCALE_X = Height/4.40;
feature.MODEL_SCALE_Y = Height/4.40;
feature.MODEL_SCALE_Z = Height/4.40;
break;

default:
feature.RULE_STYLE = "3D Model/Vegetation/Oval Hedge";
feature.MODEL_SCALE_X = 5;
feature.MODEL_SCALE_Y = 5;
feature.MODEL_SCALE_Z = 5;

}
table.Insert(feature);
feature.Invalidate();
table.CommitWriteBatch();

// signal that the tile cache needs to be regenerated
app.InvalidateTileCache(classID, geom.BBox2d);

}

var TreeFile = file.ReadFile("C:/Users/User/Desktop/Text_Docs/Nov4Treesv7.txt");

// Nov4Treesv7.txt has the following structure :
// PtID,Easting,Northing,Elevation,Type,SpeciesLabel,Species,HeightLabel,Height
//
// 100,483520.036,4762489.950,270.174,Conifer,Species,White spruce | Picea glauca,Height,23
// 101,483480.036,4762469.950,270.098,Decid,Species,Black oak | Quercus velutina,Height,17

var TreeData = TreeFile.split("\n");

for (var i = 0; i < TreeData.length; i++) {
var TreeAttrib = TreeData[i].split(",");
if (TreeAttrib.length < 9)
continue;

TreeAdd(parseFloat(TreeAttrib[1]), parseFloat(TreeAttrib[2]), parseFloat(TreeAttrib[3]), TreeAttrib[4], TreeAttrib[6], parseFloat(TreeAttrib[8]));
}

Can't find what you're looking for? Ask the community or share your knowledge.

Submit Idea  

Rail Community


 

Autodesk Design & Make Report