Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store geometry as text in mysql #60

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions freezing/sync/data/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import arrow
from freezing.model import meta
from freezing.model.orm import Athlete, Ride, RideEffort, RideError, RideGeo, RidePhoto
from geoalchemy import WKTSpatialElement
from sqlalchemy import and_, func
from sqlalchemy.orm import joinedload
from stravalib import unithelper
Expand Down Expand Up @@ -571,19 +570,15 @@ def write_ride(self, activity: Activity) -> Ride:
"""
session = meta.scoped_session()
if activity.start_latlng:
start_geo = WKTSpatialElement(
"POINT({lon} {lat})".format(
lat=activity.start_latlng.lat, lon=activity.start_latlng.lon
)
start_geo = "POINT({lon} {lat})".format(
lat=activity.start_latlng.lat, lon=activity.start_latlng.lon
)
else:
start_geo = None

if activity.end_latlng:
end_geo = WKTSpatialElement(
"POINT({lon} {lat})".format(
lat=activity.end_latlng.lat, lon=activity.end_latlng.lon
)
end_geo = "POINT({lon} {lat})".format(
lat=activity.end_latlng.lat, lon=activity.end_latlng.lon
)
else:
end_geo = None
Expand Down
1 change: 0 additions & 1 deletion freezing/sync/data/athlete.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
RidePhoto,
Team,
)
from geoalchemy import WKTSpatialElement
from sqlalchemy import and_
from sqlalchemy.orm import joinedload
from stravalib import model as sm
Expand Down
3 changes: 1 addition & 2 deletions freezing/sync/data/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from freezing.model import meta
from freezing.model.orm import Athlete, Ride, RideTrack
from geoalchemy import WKTSpatialElement
from polyline.codec import PolylineCodec
from sqlalchemy import and_, or_, update
from sqlalchemy.orm import joinedload
Expand Down Expand Up @@ -151,7 +150,7 @@ def write_ride_streams(self, streams: List[Stream], ride: Ride):
RideTrack.__table__.delete().where(RideTrack.ride_id == ride.id)
)

gps_track = WKTSpatialElement(wktutils.linestring_wkt(lonlat_points))
gps_track = wktutils.linestring_wkt(lonlat_points)

ride_track = RideTrack()
ride_track.gps_track = gps_track
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PyMySQL==1.1.1
colorlog==4.1.0
datadog==0.33.0
envparse==0.2.0
freezing-model @ https://github.com/freezingsaddles/freezing-model/archive/0.8.6.tar.gz
freezing-model @ https://github.com/freezingsaddles/freezing-model/archive/0.8.8.tar.gz
greenstalk==1.0.1
polyline==1.4.0
pytz==2024.2
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from setuptools import setup

version = "1.4.7"
version = "1.4.8"

long_description = """
freezing-sync is the component responsible for fetching activities, weather data, etc.
Expand Down
Loading