Skip to content
Snippets Groups Projects
Commit 9300a5ce authored by Sara Savanovic Djordjevic's avatar Sara Savanovic Djordjevic
Browse files

add: get_markers in server

parent 7e7b32bc
No related branches found
No related tags found
1 merge request!1Server
......@@ -21,3 +21,9 @@ class DataPoint:
self.accuracy = accuracy
class MarkerTemplate:
def __init__(self, longitude, latitude, size, color):
self.longitude = longitude
self.latitude = latitude
self.size = size
self.color = color
\ No newline at end of file
from data_structs import MarkerTemplate
def get_markers():
testData = [
MarkerTemplate(latitude=60.7266, longitude=10.9771, size=50.0, color='blue'),
MarkerTemplate(latitude=60.8366, longitude=10.8171, size=70.0, color='red'),
MarkerTemplate(latitude=60.7366, longitude=10.8471, size=60.0, color='green'),
]
# Return jsonified marker list
return json.dumps([marker.to_dict() for marker in testData])
This diff is collapsed.
[
{
"longitude": 1.0,
"latitude": 2.0,
"precipitation": 10.5,
"thickness": 3.0,
"max_weight": 50.0,
"safety_level": 2.5,
"accuracy": 8
},
{
"longitude": -3.5,
"latitude": 4.5,
"precipitation": 5.0,
"thickness": 2.8,
"max_weight": 45.0,
"safety_level": 3.2,
"accuracy": 9
}
]
\ No newline at end of file
import sys
sys.path.append('..') # Add root directory to the system path
from data_structs import DataPoint
# Test instances
test_data1 = DataPoint(longitude=1.0, latitude=2.0, precipitation=10.5, thickness=3.0, max_weight=50.0, safety_level=2.5, accuracy=8)
test_data2 = DataPoint(longitude=-3.5, latitude=4.5, precipitation=5.0, thickness=2.8, max_weight=45.0, safety_level=3.2, accuracy=9)
test_data3 = DataPoint(longitude=0.0, latitude=0.0, precipitation=None, thickness=0.0, max_weight=0.0, safety_level=3.0, accuracy=9)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment