vGIS Admin Portal Scripting Language (KB-TT010)
vGIS supports custom post-processing configuration for GIS data. Post-processing is handled through scripts applied to Datasources. The foundation of vGIS scripts is LUA programming language.
Data processing takes the source object (specific to each data source type - e.g., placemarks for KML and featured for ArcGIS) and applies configuration settings to it (see below). The transformation produces a unified destination object (see below).
Scripts are executed after data is processed. At the logical level, scripts have access to source, destination and configuration objects.
Notes and Recommendations
- Use local keywork for new variables instead of global (by default)
- To work with attributes in destination object use GetDynacmicProperty(name,defaultData)/SetDynamicProperty(name,value) methods
- To work with GUID use examples below
- All measurement units in destination should be in meters, and the script must call ToMeters() function when using values from MeasuringTypeField or MeasuringTypeValue.
Examples
Example 1
Treat the value of "1" in the depth field as null and use the default depth instead.
if configuration.DepthField ~= nil and configuration.DefaultDepth ~= nil then local nullMarker = '1'; -- Use default depth if depth field contains null marker or if such field doesn't exist. local depth = destination:GetDynamicProperty(configuration.DepthField.FieldName, nullMarker); if depth == nullMarker then destination.Altitude = configuration.DefaultDepth:ToMeters(); end end
Example 2
Treat the value of "1" in the Diameter field as null and use the default diameter instead.
if configuration.ObjectType == ObjectTypeNew.Line and configuration.ObjectTypeConfiguration.DiameterField ~= nil and configuration.ObjectTypeConfiguration.DefaultDiameter ~= nil then local nullMarker = '1'; -- Use default depth if depth field contains null marker or if such field doesn't exist. local diameter = destination:GetDynamicProperty(configuration.ObjectTypeConfiguration.DiameterField.FieldName, nullMarker); if diameter == nullMarker then destination.ObjectTypeNewData.Diameter = configuration.ObjectTypeConfiguration.DefaultDiameter:ToMeters(); end end
Example 3
Code examples for a single layer.
- The layer is detected using the destination's LayerFullId
- ROOT layer isn't included in the full Id
- The full id of the layer can be identified at the feature layer configurations -> Statistic page
if destination.LayerFullId == 'grouplayer19/featurelayer20' then -- YOUR CODE HERE end
Example 4
Working with GUID type.
GuidClass=luanet.import_type('System.Guid') guid_cons=luanet.get_constructor_bysig(GuidClass,'System.String') destination.SceneLayer = guid_cons('11111111-1111-1111-1111-111111111111')
Example 5
Changing geometry dynamically.
local geoidShift = -0.45 if destination.GeometryType == GeometryType.Polygon or destination.GeometryType == GeometryType.Line then for i = 0, destination.Geometry.Points.Count - 1, 1 do destination.Geometry.Points[i].Altitude = destination.Geometry.Points[i].Altitude + geoidShift; end elseif destination.GeometryType == GeometryType.Point then destination.Geometry.Altitude = destination.Geometry.Altitude + geoidShift end
Objects Reference
Note: Points object type reference is incomplete as the system is being updated for the "Manhole" object type.
Destination object
Disclaimer: Reference includes only fields that are likely to be used in scripting, could be expanded by request
- ExternalId:string
- LayerId: string
- LayerName: string
- LayerFullId:string
- MainColor: string
- SecondColor: string
- ObjectType: nullable ObjectTypeNew
- ObjectTypeNewData: ObjectTypeNewDataDto
- LabelConfiguration: LabelConfigurationDto
- Title: string
- Header: string
- Name: string
- GeometryType: nullable GeometryType
- Geometry: IGeometryDto
- AltitudeMode: AltitudeModeDto
- SceneLayer: GUID
- GisSymbol: string
- Latitude: number
- Longitude: number
- Altitude: number
- Subtype: string
Configuration Object
Configuration that can be set for each layer. Note: Reference includes only fields that are likely to be used in scripting; the documentation will be updated with additional field types in the future.
- LayerId: string
- LayerName: string
- MainColor: string
- SecondColor: string
- DefaultDepth: MeasuringTypeValue
- ObjectType: nullableObjectTypeNew
- ObjectTypeConfiguration: ObjectTypeConfiguration
- SubtypeField: string
- DepthField: MeasuringTypeField
- ExternalIdField: string
- Title: string
- TitleField: string
- AltitudeMode: nullable AltitudeMode
- Layer: GUID
- GeometryType: nullable GeometryType
- UseVGisSymbols: boolean
- DisplayAtCalibration: boolean
ObjectTypeNew enum
- Unknown
- Point
- Line
- Area
ObjectTypeNewDataDto
- ObjectType: ObjectTypeNew
- For ObjectTypeNew.Point:
- EnclosedShape: string
- BoundingBoxWidth: nullable number
- BoundingBoxHeight: nullable number
- BoundingBoxShape: nullable Point3DShape
- UndergroundConnectorDepth: nullable number
- For ObjectTypeNew.Line:
- LineSubtype: LineSubtype
- IsForwardDirection: nullable boolean
- For LineSubtype.Line:
- Width: nullable number
- Height: nullable number
- For LineSubtype.Pipe:
- Diameter: nullable number
- For ObjectTypeNew.Area:
- Height: nullable number
ObjectTypeConfiguration
- ObjectType: ObjectTypeNew
- For ObjectTypeNew.Point:
- DisplayAtCalibration: boolean
- EnclosedShape: string
- BoundingBoxWidth: MeasuringTypeValue
- BoundingBoxWidthField: MeasuringTypeField
- BoundingBoxHeight: MeasuringTypeValue
- BoundingBoxHeightField: MeasuringTypeField
- BoundingBoxShape: nullable Point3DShape
- UndergroundConnectorDepth: MeasuringTypeValue
- For ObjectTypeNew.Line:
- DisplayAtCalibration: boolean
- LineSubtype: LineSubtype
- IsForwardDirection: nullable boolean
- For LineSubtype.Line:
- DefaultWidth: MeasuringTypeValue
- WidthField: MeasuringTypeField
- DefaultHeight: MeasuringTypeValue
- HeightField: MeasuringTypeField
- For LineSubtype.Pipe:
- DefaultDiameter: MeasuringTypeValue
- DiameterField: MeasuringTypeField
- For ObjectTypeNew.Area:
- DefaultHeight: MeasuringTypeValue
- HeightField: MeasuringTypeField
LabelConfigurationDto
- LabelMarker: LabelMarkerDto
- ShowText: boolean
- ShowRiser: boolean
GeometryType enum
- Point
- Line
- MultiGeometry
- Polygon
IGeometryDto
- GeometryType: GeometryType
- For GeometryType.Point (PointDto):
- Latitude: number
- Longitude: number
- Altitude: nullable number
- For GeometryType.Line
- Points: array of PointDto (see above):
- For GeometryType.Polygon
- Points: array of PointDto (see above):
- For GeometryType.MultiGeometry
- Geometries: array of IGeometryDto
AltitudeMode enum
- RelativeToGround
- Absolute
- ClampToGround
AltitudeModeDto enum
- RelativeToGround
- Absolute
- ClampToGround
MeasuringTypeField
- FieldName: string
- Type: MeasurmentSystemTypeDto
- InvertValue: boolean
MeasuringTypeValue
- Value: number
- Type: MeasurmentSystemTypeDto
MeasurementSystemTypeDto enum
- Meters
- Feet
- Inches
- Centimeters
- Millimeters
Point3DShape enum
- Cylinder
- Rectangle
- Sphere
- TriangularPyramid
- SquarePyramid
- Cone
- TriangularPrism
- SquarePrism
- Rhombus
- HexagonPrism
- HalfSphere
- Cuboid
- ManholeSymmetric
- ManholeAsymmetric
- Dodecahedron
- Icosahedron
- Diamond
Have Questions? Feel free to Submit A Request to speak with a member of the vGIS Support Team.
Revised: 2024-03-07