Skip to content

Commit

Permalink
fix error on no intersection
Browse files Browse the repository at this point in the history
  • Loading branch information
hambsch committed Jul 8, 2024
1 parent d526aab commit e22f01a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions server/guppy/endpoints/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,10 @@ def get_point_value_from_layer(db: Session, layer_name: str, x: float, y: float)
# get the value of the point
point = wkt.loads(f'POINT ({x} {y})')
values = tile_df[tile_df.intersects(point)].drop(columns=['geometry'])
result = {'type': 'point value', 'layer_name': layer_name, 'value': values.to_dict(orient='records')[0]}
logger.info(f'get_point_value_from_raster 200 {time.time() - t}')
return result
if values:
result = {'type': 'point value', 'layer_name': layer_name, 'value': values.to_dict(orient='records')[0]}
logger.info(f'get_point_value_from_raster 200 {time.time() - t}')
return result
logger.warning(f'file not found {path}')
logger.info(f'get_point_value_from_raster 204 {time.time() - t}')
return Response(status_code=status.HTTP_204_NO_CONTENT)
Expand Down

0 comments on commit e22f01a

Please sign in to comment.