Skip to content

Commit

Permalink
Location update, trying to pass tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pclemow committed Aug 9, 2024
1 parent 5035284 commit 01ea7fa
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions app/svg.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
"""Module for handling and displaying SVGs."""

import base64
import math
import json
import math
from pathlib import Path

import numpy as np
import pandas as pd



class SVG:
"""Class to format SVGs for display."""

Expand Down Expand Up @@ -183,18 +182,19 @@ def get_agent_map_coordinates(df: pd.DataFrame) -> tuple[list[float], list[float
Returns:
tuple[list[float], list[float]]: lists of x and y coordinates
"""

x_coordinates = []
y_coordinates = []
agent_polys = np.random.uniform(0, len(Gridlington['Polygons']['ID'])-1, 1000).tolist()
agent_polys = np.random.uniform(
0, len(Gridlington["Polygons"]["ID"]) - 1, 1000
).tolist()

for poly in agent_polys:
poly_c = Gridlington['Polygons']['SVG_Centre'][round(poly)]
x_coordinates.append(poly_c[0]*svg_map.width)
y_coordinates.append(poly_c[1]*svg_map.width)
poly_c = Gridlington["Polygons"]["SVG_Centre"][round(poly)]
x_coordinates.append(poly_c[0] * svg_map.width)
y_coordinates.append(poly_c[1] * svg_map.width)

#x_coordinates = np.random.uniform(0, svg_map.width, 1000).tolist()
#y_coordinates = np.random.uniform(0, svg_map.height, 1000).tolist()
# x_coordinates = np.random.uniform(0, svg_map.width, 1000).tolist()
# y_coordinates = np.random.uniform(0, svg_map.height, 1000).tolist()
return x_coordinates, y_coordinates


Expand All @@ -216,12 +216,14 @@ def get_ev_map_coordinates(df: pd.DataFrame) -> tuple[list[float], list[float]]:
"""
x_coordinates = []
y_coordinates = []
agent_polys = np.random.uniform(0, len(Gridlington['Polygons']['ID'])-1, 1000).tolist()
agent_polys = np.random.uniform(
0, len(Gridlington["Polygons"]["ID"]) - 1, 1000
).tolist()

for poly in agent_polys:
poly_c = Gridlington['Polygons']['SVG_Centre'][round(poly)]
x_coordinates.append(poly_c[0]*svg_map.width)
y_coordinates.append(poly_c[1]*svg_map.width)
poly_c = Gridlington["Polygons"]["SVG_Centre"][round(poly)]
x_coordinates.append(poly_c[0] * svg_map.width)
y_coordinates.append(poly_c[1] * svg_map.width)

return x_coordinates, y_coordinates

Expand Down

0 comments on commit 01ea7fa

Please sign in to comment.