Private
Public Access
1
0

Merge branch 'develop' into feature/garmin

This commit is contained in:
Sander Roosendaal
2020-07-04 06:56:27 +02:00
11 changed files with 207 additions and 23 deletions

View File

@@ -25,7 +25,8 @@ import re
import pytz
from django_countries.fields import CountryField
from scipy.interpolate import splprep, splev, CubicSpline
from scipy.interpolate import splprep, splev, CubicSpline,interp1d
import numpy as np
import shutil
@@ -438,8 +439,10 @@ def course_spline(coordinates):
tnew = np.linspace(0,1,100)
try:
latnew = CubicSpline(t,latitudes,bc_type='clamped')(tnew)
lonnew = CubicSpline(t,longitudes,bc_type='clamped')(tnew)
#latnew = CubicSpline(t,latitudes,bc_type='not-a-knot')(tnew)
#lonnew = CubicSpline(t,longitudes,bc_type='not-a-knot')(tnew)
latnew = interp1d(t,latitudes)(tnew)
lonnew = interp1d(t,longitudes)(tnew)
except ValueError:
latnew = latitudes
lonnew = longitudes
@@ -1225,6 +1228,7 @@ class GeoCourse(models.Model):
name = models.CharField(max_length=150,blank=True)
country = models.CharField(max_length=150,blank=True)
notes = models.CharField(blank=True,max_length=200,verbose_name='Course Notes')
def __str__(self):
name = self.name
country = self.country
@@ -1240,6 +1244,10 @@ class GeoCourse(models.Model):
d = d,
)
@property
def coord(self):
return course_coord_center(self)
class GeoCourseEditForm(ModelForm):
class Meta:
model = GeoCourse