better maps splines
This commit is contained in:
@@ -1868,7 +1868,7 @@ def course_map(course):
|
|||||||
var mymap = L.map('map_canvas', {{
|
var mymap = L.map('map_canvas', {{
|
||||||
center: [{latmean}, {lonmean}],
|
center: [{latmean}, {lonmean}],
|
||||||
zoom: 13,
|
zoom: 13,
|
||||||
layers: [streets, satellite]
|
layers: [outdoors]
|
||||||
}}).setView([{latmean},{lonmean}], 13);
|
}}).setView([{latmean},{lonmean}], 13);
|
||||||
|
|
||||||
var navionics = new JNC.Leaflet.NavionicsOverlay({{
|
var navionics = new JNC.Leaflet.NavionicsOverlay({{
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ import re
|
|||||||
import pytz
|
import pytz
|
||||||
from django_countries.fields import CountryField
|
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 numpy as np
|
||||||
|
|
||||||
import shutil
|
import shutil
|
||||||
@@ -438,8 +439,10 @@ def course_spline(coordinates):
|
|||||||
tnew = np.linspace(0,1,100)
|
tnew = np.linspace(0,1,100)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
latnew = CubicSpline(t,latitudes,bc_type='clamped')(tnew)
|
#latnew = CubicSpline(t,latitudes,bc_type='not-a-knot')(tnew)
|
||||||
lonnew = CubicSpline(t,longitudes,bc_type='clamped')(tnew)
|
#lonnew = CubicSpline(t,longitudes,bc_type='not-a-knot')(tnew)
|
||||||
|
latnew = interp1d(t,latitudes)(tnew)
|
||||||
|
lonnew = interp1d(t,longitudes)(tnew)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
latnew = latitudes
|
latnew = latitudes
|
||||||
lonnew = longitudes
|
lonnew = longitudes
|
||||||
|
|||||||
Reference in New Issue
Block a user