py4design.pycitygml.write_gml module

class py4design.pycitygml.write_gml.XMLNamespaces

Contains all the XML namespaces of the CityGML schema.

citygml = 'http://www.opengis.net/citygml/1.0'
core = 'http://www.opengis.net/citygml/base/1.0'
xsi = 'http://www.w3.org/2001/XMLSchema-instance'
trans = 'http://www.opengis.net/citygml/transportation/1.0'
wtr = 'http://www.opengis.net/citygml/waterbody/1.0'
gml = 'http://www.opengis.net/gml'
smil20lang = 'http://www.w3.org/2001/SMIL20/Language'
grp = 'http://www.opengis.net/citygml/cityobjectgroup/1.0'
luse = 'http://www.opengis.net/citygml/landuse/1.0'
frn = 'http://www.opengis.net/citygml/cityfurniture/1.0'
app = 'http://www.opengis.net/citygml/appearance/1.0'
tex = 'http://www.opengis.net/citygml/texturedsurface/1.0'
smil20 = 'http://www.w3.org/2001/SMIL20/'
xAL = 'urn:oasis:names:tc:ciq:xsdschema:xAL:2.0'
bldg = 'http://www.opengis.net/citygml/building/1.0'
dem = 'http://www.opengis.net/citygml/relief/1.0'
veg = 'http://www.opengis.net/citygml/vegetation/1.0'
gen = 'http://www.opengis.net/citygml/generics/1.0'
py4design.pycitygml.write_gml.write_root()

This function writes the root node of a CityGML model.

Returns:

root node : lxml Element

The root node of a CityGML file.

py4design.pycitygml.write_gml.write_boundedby(parent_node, epsg, lower_bound, upper_bound)

This function writes the boundedby node of a CityGML model.

Parameters:

parent_node : lxml Element

The parent node of the boundedby node.

epsg : str

The epsg of the coordinate system.

lower_bound : tuple of floats

A tuple of floats that is specifying the xyz coordinate of the lower bound.

upper_bound : tuple of floats

A tuple of floats that is specifying the xyz coordinate of the upper bound.

py4design.pycitygml.write_gml.write_gen_attribute(parent_node, generic_attrib_dict)

This function writes generic attributes for a cityobject member.

Parameters:

parent_node : lxml Element

The parent node of the generic attributes node, usually a cityobject member.

generic_attrib_dict : dictionary, optional

Extra attributes to be appended to the object. The dictionary must have a string key which will be the name of the generic attributes, and either an int, float or str value.

py4design.pycitygml.write_gml.write_landuse(lod, name, geometry_list, function=None, generic_attrib_dict=None)

This function writes the landuse cityobject member. Currently, only works for lod1.

Parameters:

lod : str

The level of detail of the geometry of the landuse. The string should be in this form: “lod1”.

name : str

The name of the landuse.

geometry_list : list of SurfaceMember

The geometry of the landuse.

function : str, optional

The function of the landuse in gml code, e.g. for residential specify “1010”, Default = None. Refer to CityGML documentation for more information. https://www.citygml.org/

generic_attrib_dict : dictionary, optional

Extra attributes to be appended to the object, Default = None. The dictionary must have a string key which will be the name of the generic attributes, and either an int, float or str value.

py4design.pycitygml.write_gml.write_tin_relief(lod, name, geometry_list)

This function writes the TIN relief cityobject member. Currently, only works for lod1.

Parameters:

lod : str

The level of detail of the geometry of the tin relief. The string should be in this form: “lod1”.

name : str

The name of the relief feature.

geometry_list : list of Triangle

The geometry of the tin relief.

py4design.pycitygml.write_gml.write_transportation(trpt_type, lod, name, geometry_list, rd_class=None, function=None, generic_attrib_dict=None)

This function writes the transportation cityobject member. Transportation object includes road, railway, track and square. Currently only works for lod0 transportation network.

Parameters:

trpt_type : str

The transportation type. The options are: “Road”, “Railway”, “Track”, “Square”.

lod : str

The level of detail of the geometry of the transportation. The string should be in this form: “lod0”.

name : str

The name of the transportation object.

geometry_list : list of Linestring

The geometry of the landuse.

rd_class : str, optional

The class of the transportation gml code, e.g. for road specify “1000”, Default = None. Refer to CityGML documentation for more information. https://www.citygml.org/

function : str, optional

The function of the transportation gml code, e.g. for road specify “1000”, Default = None. Refer to CityGML documentation for more information. https://www.citygml.org/

generic_attrib_dict : dictionary, optional

Extra attributes to be appended to the object, Default = None. The dictionary must have a string key which will be the name of the generic attributes, and either an int, float or str value.

py4design.pycitygml.write_gml.write_building(lod, name, geometry_list, bldg_class=None, function=None, usage=None, yr_constr=None, rooftype=None, height=None, stry_abv_grd=None, stry_blw_grd=None, generic_attrib_dict=None)

This function writes the building cityobject member. Currently, only works for lod1 building.

Parameters:

lod : str

The level of detail of the geometry of the building. The string should be in this form: “lod1”.

name : str

The name of the building.

geometry_list : list of SurfaceMember

The geometry of the building.

bldg_class : str, optional

The building class of the building in gml code e.g. for habitation specify “1000”, Default = None. Refer to CityGML documentation for more information. https://www.citygml.org/

function : str, optional

The function of the building in gml code e.g. for residential specify “1000”, Default = None. Refer to CityGML documentation for more information. https://www.citygml.org/

usage : str, optional

The usage of the building in gml code e.g. for residential specify “1000”, Default = None. Refer to CityGML documentation for more information. https://www.citygml.org/

yr_constr : str, optional

The year the building is constructed e.g. “2017”, Default = None.

rooftype : str, optional

The rooftype of the building in gml code e.g. for flat roof specify “1000”, Default = None. Refer to CityGML documentation for more information. https://www.citygml.org/

height : str, optional

The height of the building, e.g. “48”, Default = None.

stry_abv_grd : str, optional

The number of storey of the building above ground, e.g. “12”, Default = None.

stry_blw_grd : str, optional

The number of storey of the building below ground, e.g. “2”, Default = None.

generic_attrib_dict : dictionary, optional

Extra attributes to be appended to the object, Default = None. The dictionary must have a string key which will be the name of the generic attributes, and either an int, float or str value.

py4design.pycitygml.write_gml.write_cityfurniture(lod, name, geometry_list, furn_class=None, function=None, generic_attrib_dict=None)

This function writes the city furniture cityobjectmemeber. Currently, only works for lod1.

Parameters:

lod : str

The level of detail of the geometry of the furniture. The string should be in this form: “lod1”.

name : str

The name of the furniture.

geometry_list : list of SurfaceMember

The geometry of the furniture.

furn_class : str, optional

The furniture class of the city furniture in gml code, for traffic specify “1000”, Default = None. Refer to CityGML documentation for more information. https://www.citygml.org/

function : str, optional

The function of the city furniture in gml code, for bus stop specify “1110”,Default = None. Refer to CityGML documentation for more information. https://www.citygml.org/

generic_attrib_dict : dictionary, optional

Extra attributes to be appended to the object, Default = None. The dictionary must have a string key which will be the name of the generic attributes, and either an int, float or str value.

py4design.pycitygml.write_gml.pos_list2text(pyptlist)

This function converts the pyptlist into text form for CityGML.

Parameters:

pyptlist : a list of tuples

List of points to be converted. A pypt is a tuple that documents the xyz coordinates of a pt e.g. (x,y,z), thus a pyptlist is a list of tuples e.g. [(x1,y1,z1), (x2,y2,z2), …]

Returns:

converted list of points : str

The pyptlist converted into string form.

py4design.pycitygml.write_gml.write_surface_member(pyptlist)

This function writes a GML surface member.

Parameters:

pyptlist : a list of tuples

List of points to be converted. A pypt is a tuple that documents the xyz coordinates of a pt e.g. (x,y,z), thus a pyptlist is a list of tuples e.g. [(x1,y1,z1), (x2,y2,z2), …]

Returns:

surface member : lxml Element

The lxml surface member.

py4design.pycitygml.write_gml.write_triangle(pyptlist)

This function writes a GML triangle member.

Parameters:

pyptlist : a list of tuples

List of points to be converted. A pypt is a tuple that documents the xyz coordinates of a pt e.g. (x,y,z), thus a pyptlist is a list of tuples e.g. [(x1,y1,z1), (x2,y2,z2), …]

Returns:

triangle member : lxml Element

The lxml triangle member.

py4design.pycitygml.write_gml.write_linestring(pyptlist)

This function writes a GML linestring member.

Parameters:

pyptlist : a list of tuples

List of points to be converted. A pypt is a tuple that documents the xyz coordinates of a pt e.g. (x,y,z), thus a pyptlist is a list of tuples e.g. [(x1,y1,z1), (x2,y2,z2), …]

Returns:

linestring member : lxml Element

The lxml linestring member.

py4design.pycitygml.write_gml.write_pt(pypt)

This function writes a GML point member.

Parameters:

pypt : tuple of floats

A pypt is a tuple that documents the xyz coordinates of a pt e.g. (x,y,z).

Returns:

point member : lxml Element

The lxml point member.