kml.model
Places a 3D model in the coordinates defined by longitude, latitude and altitude, and orientation given by heading, tilt and roll.
Contents
Syntax
kml.model(longitude, latitude, altitude, heading, tilt, roll) kml.model(...,'PropertyName',PropertyValue,...)
Description
Places a 3D model in the coordinates defined by the inputs longitude, latitude and altitude, and orientation given by heading, tilt and roll. The 3D model should be specified by the property pair 'model', 'modelfile.dae' and should be located in the same path where the kml file will be saved.
The units for the angular values are normally given in degrees, but this can be changed by calling: kml.useDegrees; or kml.useRadians; before plotting. Altitude is always given in meters.
If the inputs are arrays of coordinates and orientations, a copy of the 3D model will be placed in every one of them.
Many user-generated models can be found in the Google 3D Warehouse website.
It is possible to fine tune the point properties using name-value pairs:
kml.model(...,'PropertyName',PropertyValue,...)
Properties
Property Name | Type | Description |
---|---|---|
'model' | string | Path to the 3D model file. This is a required input. |
'name' | string | Name of the model inside the kml file |
'id' | string | Internal id of this model inside the kml |
'description' | string | A short description of what the model represents |
'visibility' | true/false | Control the initial visibility of the model |
'scale' | double | Defines a scale factor to be applied to the model. Can be one input for all models, or an array with the same size as Longitude, with the size of the model at each coordinate |
'scaleX' | double | Defines a scale factor to be applied to the model in the x-axis. Can be one input for all models, or an array with the same size as Longitude, with the size of the model at each coordinate |
'scaleY' | double | Defines a scale factor to be applied to the model in the y-axis. Can be one input for all models, or an array with the same size as Longitude, with the size of the model at each coordinate |
'scaleZ' | double | Defines a scale factor to be applied to the model in the z-axis. Can be one input for all models, or an array with the same size as Longitude, with the size of the model at each coordinate |
'altitudeMode' | string | Choose if the altitude value is absolute to the earth model, relative to the ground level, or should be clamped to the ground. Valid inputs: 'absolute', 'relativeToGround', 'clampToGround' |
'timeStamp' | kml date string | Associates the model to a moment in time. Should not be used together with timeSpan. Should be a string in the XML time format (more information available here) |
'timeSpanBegin' | kml date string | Defines the moment in time where the model starts to exist. Should not be used together with timeStamp. Should be a string in the XML time format (more information available here) |
'timeSpanEnd' | kml date string | Defines the moment in time where the model finishes to exist. Should not be used together with timeStamp. Should be a string in the XML time format (more information available here) |
Example
% Create a new kml object k = kml('my kml file'); % Places an Airbus A320 3D model in a flight trajectory over the atlantic. N = 20; k.model(linspace(-53,8,N),linspace(-23,47,N),ones(1,N)*5e4,ones(1,N)*-145,zeros(1,N),zeros(1,N),'model','A320.dae','scale',10000) % Save the kml and open it in Google Earth k.run;
This is the result of running this example:

This file is part of the kml toolbox. Copyright 2012 Rafael Fernandes de Oliveira (rafael@rafael.aero)