def latlon(self, rmap):
        """
            Add lat/lon to location references

            @param rmap: the reference map of the tree
        """

        ATTRIBUTE = self.ATTRIBUTE

        locations = {}
        for reference in rmap:
            if reference.table == "gis_location" and len(reference.id) == 1:
                location_id = reference.id[0]
                if locations not in location_id:
                    locations[location_id] = [reference]
                else:
                    locations[location_id].append(reference)
        if locations:
            ltable = current.s3db.gis_location
            rows = current.db(ltable._id.belongs(locations.keys())) \
                             .select(ltable.id,
                                     ltable.lat,
                                     ltable.lon,
                                     ).as_dict()

            for location_id, row in rows.items():
                lat = row["lat"]
                lon = row["lon"]
                if lat is not None and lon is not None:
                    references = locations.get(location_id, ())
                    for reference in references:
                        attr = reference.element.attrib
                        attr[ATTRIBUTE.lat] = "%.4f" % lat
                        attr[ATTRIBUTE.lon] = "%.4f" % lon
        return

    # -------------------------------------------------------------------------
dataset/ETHPy150Open sahana/eden/modules/s3/s3xml.py/S3XML.latlon/swapped operands of `not in`