'Returns the Lat/Lon for a Feature
used by display_feature() in gis controller
@param feature_id: the feature ID
@param filter: Filter out results based on deployment_settings'

def get_latlon(self, feature_id, filter=False):

    db = current.db
    table = db.gis_location
    feature = db((table.id == feature_id)).select(table.id, table.lat, table.lon, table.parent, table.path, limitby=(0, 1)).first()
    if (('lon' in feature) and ('lat' in feature) and (feature.lat is not None) and (feature.lon is not None)):
        return dict(lon=feature.lon, lat=feature.lat)
    else:
        parents = self.get_parents(feature.id, feature=feature)
        if parents:
            for row in parents:
                lon = row.get('lon', None)
                lat = row.get('lat', None)
                if ((lon is not None) and (lat is not None)):
                    return dict(lon=lon, lat=lat)
    return None
