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)
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)
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))
def getIdGeoentityByName(name, idNameFamily): """Returns the idGeoentity for a name and ID name family.""" m = maplexmodel.MaplexModel() return (m.getIdGeoentityByName(name, idNameFamily))
def getGeoentityNames(idGeoentity, idNameFamily): """Returns a list with all geoentity names corresponding to the given family.""" m = maplexmodel.MaplexModel() return (m.getGeoentityNames(idGeoentity, idNameFamily))
def getName(idName): """Returns name with ID idName.""" m = maplexmodel.MaplexModel() return (m.getName(idName))
def getNames(idNameFamily=None): """Returns names.""" m = maplexmodel.MaplexModel() return (m.getNames(idNameFamily))
def getGeoentities(): """Returns geoentities.""" m = maplexmodel.MaplexModel() return (m.getGeoentities())
def getNameFamilies(): """Returns name families.""" m = maplexmodel.MaplexModel() return (m.getNameFamilies())
def addName(name, description): """Adds a name. Returns reference ID to the new name.""" m = maplexmodel.MaplexModel() id = m.newName(name, description) return (id)
def isBlock(idGeoentity): """Returns True if idGeoentity is a block.""" m = maplexmodel.MaplexModel() return (idGeoentity in m.idGeoentitiesBlocks(idGeoentity))
def getGeoentityBlocks(idGeoentity, year=None): """Returns all blocks idGeoentity is in.""" m = maplexmodel.MaplexModel() return (m.getGeoentityBlocks(idGeoentity, year))
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))