def get(self): query = MapMarker.all() root = ElementTree.Element("root") for map_marker in query.fetch(limit=50): root.append(map_marker.to_element()) self.response.write(ElementTree.tostring(root, encoding="utf-8"))
def get(self): try: longitude = float(self.request.GET["x_long"]) latitude = float(self.request.GET["y_lat"]) radius = float(self.request.GET["r"]) except KeyError as e: self.response.status = 404 return limit = self.request.GET.get("limit", 50) root = ElementTree.Element("root") result = MapMarker.proximity_fetch(MapMarker.all(), center=db.GeoPt(latitude, longitude), max_distance=radius) for map_marker in result: root.append(map_marker.to_element()) self.response.write(ElementTree.tostring(root, encoding="utf-8"))