Fiber convertor plugin

Goal is to create QGIS plugin which will create layer Demand Points from input CSV data.

User Inputs

  1. existing vector layer
  2. attribute mapping file
  3. target data structure
  4. new name for out Esri Shapefile

Process

  1. open existing vector file
  2. create new Esri Shapefile with given name and based on schema according to target data structure
  3. add new features to output file with attributes based on input vector file

Mapping file

Mapping file will be simple CSV file with two columns. First column contains attributes of the input vector file, second column coresponds to attributes of the Demand Points file:

id,gistool_id
enable,include
aansluitadres_straatnaam,streetname

Target data structure

Target file schema contains always:

  1. Geometry type (Point)
  2. Properties - their names and data types
DATA_TYPES = {
    "demand_points": {
        "geometry": {
            "type": "Point"
        },
        "properties": OrderedDict([
            ("gistool_id", QVariant.Int),
            ("include", QVariant.Bool),
            ("connection", QVariant.String),
            ("pon_adop", QVariant.Double),
            ("p2p_adop", QVariant.Double),
            ("pon_homes", QVariant.Int),
            ("p2p_homes", QVariant.Int),
            ("pon_m_rev", QVariant.Double),
            ("p2p_m_rev", QVariant.Double),
            ("bldg_id", QVariant.String),
            ("streetname", QVariant.String),
            ("identifier", QVariant.String),
            ("floorcount", QVariant.Int),
            ("locked", QVariant.Bool),
            ("forced_cbl", QVariant.String)
        ])
    }
}