'Return a list of IDs of all GIS Features which are children of
the requested feature, using Materialized path for retrieving
the children
This has been chosen over Modified Preorder Tree Traversal for
greater efficiency:
http://eden.sahanafoundation.org/wiki/HaitiGISToDo#HierarchicalTrees
@param: level - optionally filter by level
@return: Rows object containing IDs & Names
Note: This does NOT include the parent location itself'

@staticmethod
def get_children(id, level=None):

    db = current.db
    try:
        table = db.gis_location
    except:
        table = current.s3db.gis_location
    query = (table.deleted == False)
    if level:
        query &= (table.level == level)
    term = str(id)
    path = table.path
    query &= (path.like((term + '/%')) | path.like((('%/' + term) + '/%')))
    children = db(query).select(table.id, table.name)
    return children
