Pushed static maps retrieval to backend

This commit is contained in:
2019-01-27 20:11:09 +01:00
parent 2dc35bbc12
commit cc5491cd5f
3 changed files with 11 additions and 9 deletions

View File

@@ -412,6 +412,10 @@ class Spot extends Main
$sToken = Settings::IGN_FR_KEY; $sToken = Settings::IGN_FR_KEY;
$sReferer = 'https://www.visugpx.com/yfJDwfuTlf'; $sReferer = 'https://www.visugpx.com/yfJDwfuTlf';
break; break;
case 'static':
$sPattern = 'https://api.mapbox.com/v4/mapbox.satellite/url-http%3A%2F%2Fspot.lutran.fr%2Fimages%2Ffootprint.png({x},{y})/{x},{y},{z}/400x300.png?access_token={token}';
$sToken = Settings::MAPBOX_KEY;
break;
} }
$oCacher = new Cacher($sPattern, $sMapId); $oCacher = new Cacher($sPattern, $sMapId);
$oCacher->setToken($sToken); $oCacher->setToken($sToken);

View File

@@ -414,13 +414,12 @@ function getPost(asPost) {
} }
function getStaticMapUrl(oCenterLat, oCenterLng) { function getStaticMapUrl(oCenterLat, oCenterLng) {
var asParams = [ return '?'+$.param({
'https://api.mapbox.com/v4/mapbox.satellite', //Domain 'a': 'tile',
'url-http%3A%2F%2Fspot.lutran.fr%2Fimages%2Ffootprint.png('+oCenterLng+','+oCenterLat+')', //Marker 'id': 'static',
oCenterLng+','+oCenterLat+',13', //Center + zoom 'z': 13,
'400x300.png?access_token='+self.vars('mapbox_key') //Image size + access token 'x': oCenterLng,
]; 'y': oCenterLat
});
return asParams.join('/');
} }
</script> </script>

1
todo
View File

@@ -2,7 +2,6 @@ To Do List
---------- ----------
- Elevation chart - Elevation chart
- Table for images - Table for images
- Static maps in backend
- Device/Spot Class - Device/Spot Class
- Manage projects.timezone - Manage projects.timezone
- Remove files2/ on server - Remove files2/ on server