Terrain Topology

This module defines the quantized_mesh_tile.topology.TerrainTopology.

Reference

class quantized_mesh_tile.topology.TerrainTopology(geometries=[], autocorrectGeometries=False, hasLighting=False)[source]

Bases: future.types.newobject.newobject

This class is used to build the terrain tile topology.

Contructor arguments:

geometries

A list of shapely polygon geometries representing 3 dimensional triangles. or A list of WKT or WKB Polygons representing 3 dimensional triangles. or A list of triplet of vertices using the following structure: (((lon0/lat0/height0),(...),(lon2,lat2,height2)),(...))

Default is [].

autocorrectGeometries

When set to True, it will attempt to fix geometries that are not triangles. This often happens when geometries are clipped from an existing mesh.

Default is False.

hasLighting

Indicate whether unit vectors should be computed for the lighting extension.

Default is False.

Usage example:

from quantized_mesh_tile.topology import TerrainTopology
triangles = [
    [[7.3828125, 44.6484375, 303.3],
     [7.3828125, 45.0, 320.2],
     [7.5585937, 44.82421875, 310.2]],
    [[7.3828125, 44.6484375, 303.3],
     [7.734375, 44.6484375, 350.3],
     [7.734375, 44.6484375, 350.3]],
    [[7.734375, 44.6484375, 350.3],
     [7.734375, 45.0, 330.3],
     [7.5585937, 44.82421875, 310.2]],
    [[7.734375, 45.0, 330.3],
     [7.5585937, 44.82421875, 310.2],
     [7.3828125, 45.0, 320.2]]
]
topology = TerrainTopology(geometries=triangles)
print topology
_addVertices(vertices)[source]

A private method to add vertices to the terrain tile topology.

_assureCounterClockWise(vertices)[source]

Private method to make sure vertices unwind in counterwise order. Inspired by: http://stackoverflow.com/questions/1709283/ how-can-i-sort-a-coordinate-list-for-a-rectangle-counterclockwise

_create()[source]

A private method to create the final terrain data structure.

_extractVertices(geometry)[source]

Method to extract the triangle vertices from a Shapely geometry. ((lon0/lat0/height0),(...),(lon2,lat2,height2))

You should normally never use this method directly.

_loadGeometry(geometrySpec)[source]

A private method to convert a (E)WKB or (E)WKT to a Shapely geometry.

_lookupVertexIndex(lookupKey)[source]

A private method to determine if the vertex has already been discovered and return its index (or None if not found).

addGeometries(geometries)[source]

Method to add geometries to the terrain tile topology.

Arguments:

geometries

A list of shapely polygon geometries representing 3 dimensional triangles. or A list of WKT or WKB Polygons representing 3 dimensional triangles. or A list of triplet of vertices using the following structure: (((lon0/lat0/height0),(...),(lon2,lat2,height2)),(...))
ecefMaxX

A class property returning the maximal x value in ECEF coordinate system. Normally never used directly.

ecefMaxY

A class property returning the maximal y value in ECEF coordinate system. Normally never used directly.

ecefMaxZ

A class property returning the maximal z value in ECEF coordinate system. Normally never used directly.

ecefMinX

A class property returning the minimal x value in ECEF coordinate system. Normally never used directly.

ecefMinY

A class property returning the minimal y value in ECEF coordinate system. Normally never used directly.

ecefMinZ

A class property returning the minimal z value in ECEF coordinate system. Normally never used directly.

hVertex

A class property returning the height of the vertices in the tile. Normally never used directly.

indexData

A class property retuning a list specifying how the vertices are linked together. These indices refer to the values in uVertex, vVertex and hVertex of this class. Normally never used directly.

maxHeight

A class property returning the maximal height in the tile. Normally never used directly.

maxLat

A class property returning the maximal latitude in the tile. Normally never used directly.

maxLon

A class property returning the maximal longitude in the tile. Normally never used directly.

minHeight

A class property returning the minimal height in the tile. Normally never used directly.

minLat

A class property returning the minimal latitude in the tile. Normally never used directly.

minLon

A class property returning the minimal longitude in the tile. Normally never used directly.

uVertex

A class property returning the horizontal coordinates of the vertices in the tile. Normally never used directly.

vVertex

A class property returning the vertical coordinates of the vertices in the tile. Normally never used directly.