better maps splines
This commit is contained in:
@@ -1868,7 +1868,7 @@ def course_map(course):
|
||||
var mymap = L.map('map_canvas', {{
|
||||
center: [{latmean}, {lonmean}],
|
||||
zoom: 13,
|
||||
layers: [streets, satellite]
|
||||
layers: [outdoors]
|
||||
}}).setView([{latmean},{lonmean}], 13);
|
||||
|
||||
var navionics = new JNC.Leaflet.NavionicsOverlay({{
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user