config_builder module

This class is used to build a config file

class config_builder.ConfigBuilder[source]

Bases: object

A list of geographical extents [ [min_x, max_x, min_y, max_y], … ] NB: An extent is a list of coords defining boundaries of model

add_config(gs_dict, label_str, popup_dict, file_name, model_name, file_ext='.gltf', position=[0.0, 0.0, 0.0], styling={})[source]

Adds more config information to popup dictionary

Parameters:
  • gs_dict – group structure dictionary (group struct dict format: { filename: ( group_name, { insert_key1: val, insert_key2: val } } )
  • label_str – string to use as a display name for this part of the model, if none available in group struct dict
  • popup_dict – information to display in popup window ( popup dict format: { object_name: { ‘attr_name’: attr_val, … } } where ‘attr_name’ is one of: ‘name’, ‘title’, ‘href’)
  • file_name – file and path (without extension) of model part source file
  • file_ext – optional file extension of ‘file_name’, defaults to ‘.gltf’
  • position – optional [x,y,z] position of model part
  • styling – optional dict of styling parameters e.g. { “labels”: [ { “display_name”: “MARKER_TOPMOROAKVELKERRI_GRP”, “position”: [ 425500.0, 8028000.0, 228.699997 ] }, ] }
Returns:

a dict of model configuration info, which includes the popup dict

add_config_list(config_list)[source]

Add model config dict to internal list :param config_list: list of model config dicts

add_ext(ext)[source]

Adds an extent to this instance’s internal extent list :param ext: single extent [min_x, max_x, min_y, max_y]

add_inserts(gs_dict, model_part_key, modelconf_dict, alt_name)[source]

Sets the ‘display_name’ and other inserts from the group structure dictionary

Parameters:
  • gs_dict – group structure dictionary (group struct dict format: { filename: ( group_name, { insert_key1: val, insert_key2: val } } ))
  • model_part_key – model part key in ‘gs_dict’
  • modelconf_dict – dictionary of model information
  • alt_name – alternative ‘display_name’ when not supplied in ‘gs_dict’
add_vol_config(gs_dict, geom_obj, style_obj, meta_obj)[source]

Create a dictionary containing volume configuration data :param gs_dict: group structure dictionary (group struct dict format: { filename: ( group_name, { insert_key1: val, insert_key2: val } } )) :param geom_obj: ModelGeometries object :param style_obj: STYLE object :param meta_obj: METADATA object :returns: a dict of volume config data

create_json_config(output_filename, dest_dir, params)[source]

Creates a JSON file of GLTF objects to display in 3D

Parameters:
  • output_filename – name of file containing created config file
  • dest_dir – destination directory for output file
  • params – model input parameters, SimpleNamespace() object, keys are: ‘name’ ‘crs’ ‘init_cam_dist’ and optional ‘proj4_defn’
extent_list = None
has_output()[source]

Returns True iff there are model config dicts that can be written out to a config file

reduce_extents()[source]

Reduces the internal list of extents to just one extent :returns: single extent [min_x, max_x, min_y, max_y]