Exemple #1
0
def getTranslationTable(idNameFamilyA, idNameFamilyB=None):
    """Returns two dictionaries: one keyer by idNameFamilyA to idNameFamilyB conversion,
    and reverse. If idNameFamilyB is None, idGeoentity is used as idNameFamilyB."""
    m = maplexmodel.MaplexModel()
    ab = dict()
    ba = dict()
    for d in m.getTranslationTable(idNameFamilyA, idNameFamilyB):
        ab[d["name_a"]] = d["name_b"]
        ba[d["name_b"]] = d["name_a"]
    return (ab, ba)
Exemple #2
0
def assignGeoentityName(idGeoentity,
                        idName,
                        idNameFamily,
                        dateIn=None,
                        dateOut=None):
    """Assign a name to a geoentity."""
    dateIn = common.timelapse.Time(dateIn) if dateIn else None
    dateOut = common.timelapse.Time(dateOut) if dateOut else None

    m = maplexmodel.MaplexModel()
    id = m.assignGeoentityName(idGeoentity,
                               idName,
                               idNameFamily,
                               dateIn=dateIn,
                               dateOut=dateOut)
    return (id)
Exemple #3
0
def getBlocks(timeLapseBlock=None, timeLapseMembers=None, idNameFamily=None):
    """Retrieves basic information about blocks. If idNameFamily is None, idGeoentity is returned."""
    m = maplexmodel.MaplexModel()
    return (m.getBlocks(timeLapseBlock, timeLapseMembers, idNameFamily))
Exemple #4
0
def getIdGeoentityByName(name, idNameFamily):
    """Returns the idGeoentity for a name and ID name family."""
    m = maplexmodel.MaplexModel()
    return (m.getIdGeoentityByName(name, idNameFamily))
Exemple #5
0
def getGeoentityNames(idGeoentity, idNameFamily):
    """Returns a list with all geoentity names corresponding to the given family."""
    m = maplexmodel.MaplexModel()
    return (m.getGeoentityNames(idGeoentity, idNameFamily))
Exemple #6
0
def getName(idName):
    """Returns name with ID idName."""
    m = maplexmodel.MaplexModel()
    return (m.getName(idName))
Exemple #7
0
def getNames(idNameFamily=None):
    """Returns names."""
    m = maplexmodel.MaplexModel()
    return (m.getNames(idNameFamily))
Exemple #8
0
def getGeoentities():
    """Returns geoentities."""
    m = maplexmodel.MaplexModel()
    return (m.getGeoentities())
Exemple #9
0
def getNameFamilies():
    """Returns name families."""
    m = maplexmodel.MaplexModel()
    return (m.getNameFamilies())
Exemple #10
0
def addName(name, description):
    """Adds a name. Returns reference ID to the new name."""
    m = maplexmodel.MaplexModel()
    id = m.newName(name, description)
    return (id)
Exemple #11
0
def isBlock(idGeoentity):
    """Returns True if idGeoentity is a block."""
    m = maplexmodel.MaplexModel()
    return (idGeoentity in m.idGeoentitiesBlocks(idGeoentity))
Exemple #12
0
def getGeoentityBlocks(idGeoentity, year=None):
    """Returns all blocks idGeoentity is in."""
    m = maplexmodel.MaplexModel()
    return (m.getGeoentityBlocks(idGeoentity, year))
Exemple #13
0
def getBlockMembers(idGeoentityBlock, year=None, idNameFamily=None):
    """Retrieves block members. If idNameFamily is None, idGeoentity is returned. TODO: erase the idNameFamily
    from all functions. Stick exclusively to the id_geoentity. Use translation tables."""
    m = maplexmodel.MaplexModel()
    return (m.getBlockMembers(idGeoentityBlock, year, idNameFamily))