Example #1
0
 def get(self):
     args = coord_parser.parse_args()
     lat = args['lat']
     lng = args['lng']
     Logger.info("Look for IRIS for coordinate '%s, %s'", lat, lng)
     res = extract.iris_from_coordinate(lng, lat)
     return res
Example #2
0
File: app.py Project: garaud/pyris
 def get(self):
     args = coords_parser.parse_args()
     lat, lon = args['lat'], args['lon']
     Logger.info("Coordinates '%s'", (lon, lat))
     Logger.info("geojson? %s", args['geojson'])
     res = extract.iris_from_coordinate(lon, lat, args['geojson'])
     if not res:
         api.abort(404, "IRIS not found from coordinates ({}, {})".format(lat, lon))
     return res
Example #3
0
 def get(self):
     args = coords_parser.parse_args()
     lat, lon = args['lat'], args['lon']
     Logger.info("Coordinates '%s'", (lon, lat))
     Logger.info("geojson? %s", args['geojson'])
     res = extract.iris_from_coordinate(lon, lat, args['geojson'])
     if not res:
         api.abort(
             404,
             "IRIS not found from coordinates ({}, {})".format(lat, lon))
     return res
Example #4
0
 def get(self):
     args = address_parser.parse_args()
     query = args['q']
     Logger.info("Look for IRIS for address '%s'", address)
     coord = address.coordinate(query)
     Logger.info("Get coordinate (%s, %s)", coord["lon"], coord["lat"])
     Logger.info("For address '%s'", coord["address"])
     if coord['address'] is None:
         return []
     res = extract.iris_from_coordinate(coord['lon'], coord['lat'])
     res.update(coord)
     return res
Example #5
0
 def get(self):
     args = address_parser.parse_args()
     query = args['q']
     Logger.info("Look for IRIS for address '%s'", address)
     coord = address.coordinate(query)
     Logger.info("Get coordinate (%s, %s)", coord["lon"], coord["lat"])
     Logger.info("For address '%s'", coord["address"])
     if coord['address'] is None:
         return []
     res = extract.iris_from_coordinate(coord['lon'], coord['lat'])
     res.update(coord)
     return res
Example #6
0
File: app.py Project: garaud/pyris
 def get(self, query):
     Logger.info("Looking for the list of iris in the city matching the query %s", query)
     Logger.info("Looking for longitude and latitude for the query %s", query)
     coord=address.coordinate(query)
     if coord["address"] is None:
         # Requests sent to '/api/search' that match nothing do not return a 404 error like other requests.
         # Is this an intentional choice?
         api.abort(404, "No city found matching that query")
     # I'm pretty sure the preferred order is usually latitude first, then longitude
     Logger.info("Looking for iris at coordinates %s, %s", coord["lat"], ["lon"])
     iris=extract.iris_from_coordinate(coord["lon"], coord["lat"])
     iris_list=extract.get_iris_list_by_city_code(iris["citycode"])
     return {"city_name": iris["city"], "city_code": iris["citycode"], "iris_list": iris_list}
Example #7
0
 def get(self):
     args = address_parser.parse_args()
     q, postcode, citycode, lat, lon, limit = args['q'], args[
         'postcode'], args['citycode'], args['lat'], args['lon'], args[
             'limit']
     Logger.info(
         "Look for IRIS for q '%s', postcode '%s', citycode '%s', lat '%s' , lon '%s', limit '%s'",
         q, postcode, citycode, lat, lon, limit)
     coord = address.coordinate(q, postcode, citycode, lat, lon, limit)
     Logger.info("Get coordinate (%s, %s)", coord["lon"], coord["lat"])
     Logger.info("For address '%s'", coord["address"])
     if coord['address'] is None:
         return []
     res = extract.iris_from_coordinate(coord['lon'], coord['lat'],
                                        args['geojson'])
     res.update(coord)
     return res
Example #8
0
 def get(self, query):
     Logger.info(
         "Looking for the list of iris in the city matching the query %s",
         query)
     Logger.info("Looking for longitude and latitude for the query %s",
                 query)
     coord = address.coordinate(query)
     if coord["address"] is None:
         # Requests sent to '/api/search' that match nothing do not return a 404 error like other requests.
         # Is this an intentional choice?
         api.abort(404, "No city found matching that query")
     # I'm pretty sure the preferred order is usually latitude first, then longitude
     Logger.info("Looking for iris at coordinates %s, %s", coord["lat"],
                 ["lon"])
     iris = extract.iris_from_coordinate(coord["lon"], coord["lat"])
     iris_list = extract.get_iris_list_by_city_code(iris["citycode"])
     return {
         "city_name": iris["city"],
         "city_code": iris["citycode"],
         "iris_list": iris_list
     }
Example #9
0
 def get(self):
     args = address_parser.parse_args()
     q, postcode, citycode, lat, lon, limit = args['q'], args[
         'postcode'], args['citycode'], args['lat'], args['lon'], args[
             'limit']
     Logger.info(
         "Look for a list of IRIS in a city for q '%s', postcode '%s', citycode '%s', lat '%s' , lon '%s', limit '%s'",
         q, postcode, citycode, lat, lon, limit)
     coord = address.coordinate(q, postcode, citycode, lat, lon, limit)
     if coord["address"] is None:
         # Requests sent to '/api/search' that match nothing do not return a 404 error like other requests.
         # Is this an intentional choice?
         api.abort(404, "No city found matching that query")
     # I'm pretty sure the preferred order is usually latitude first, then longitude
     Logger.info("Looking for iris at coordinates %s, %s", coord["lat"],
                 ["lon"])
     iris = extract.iris_from_coordinate(coord["lon"], coord["lat"])
     iris_list = extract.get_iris_list_by_city_code(iris["citycode"])
     return {
         "city_name": iris["city"],
         "city_code": iris["citycode"],
         "iris_list": iris_list
     }