use new geo server for tiles
This commit is contained in:
14
inc/spot.php
14
inc/spot.php
@@ -41,7 +41,6 @@ class Spot extends Main
|
|||||||
array('name'=>'feed', 'project'=>true),
|
array('name'=>'feed', 'project'=>true),
|
||||||
array('name'=>'project', 'project'=>true),
|
array('name'=>'project', 'project'=>true),
|
||||||
array('name'=>'picture', 'project'=>true),
|
array('name'=>'picture', 'project'=>true),
|
||||||
array('name'=>'wmts', 'project'=>false),
|
|
||||||
array('name'=>'converter', 'project'=>true)
|
array('name'=>'converter', 'project'=>true)
|
||||||
);
|
);
|
||||||
parent::__construct($oClassManagement, $sProcessPage, $asClasses);
|
parent::__construct($oClassManagement, $sProcessPage, $asClasses);
|
||||||
@@ -121,11 +120,11 @@ class Spot extends Main
|
|||||||
array(
|
array(
|
||||||
'vars' => array(
|
'vars' => array(
|
||||||
'chunk_size' => self::FEED_CHUNK_SIZE,
|
'chunk_size' => self::FEED_CHUNK_SIZE,
|
||||||
'mapbox_key' => Settings::MAPBOX_KEY,
|
|
||||||
'default_project_codename' => $this->oProject->getProjectCodeName(),
|
'default_project_codename' => $this->oProject->getProjectCodeName(),
|
||||||
'projects' => $this->oProject->getProjects()
|
'projects' => $this->oProject->getProjects()
|
||||||
),
|
),
|
||||||
'consts' => array(
|
'consts' => array(
|
||||||
|
'geo_server' => Settings::GEO_SERVER,
|
||||||
'modes' => Project::MODES,
|
'modes' => Project::MODES,
|
||||||
'site_timezone' => Settings::TIMEZONE,
|
'site_timezone' => Settings::TIMEZONE,
|
||||||
'site_timezone_desc' => self::getTimeZoneDesc(Settings::TIMEZONE)
|
'site_timezone_desc' => self::getTimeZoneDesc(Settings::TIMEZONE)
|
||||||
@@ -133,7 +132,7 @@ class Spot extends Main
|
|||||||
),
|
),
|
||||||
'index',
|
'index',
|
||||||
array(
|
array(
|
||||||
'host_url' => Settings::HOST_SERVER,
|
'host_url' => $this->asContext['serv_name'],
|
||||||
'filepath_css' => self::addTimestampToFilePath('style/spot.css'),
|
'filepath_css' => self::addTimestampToFilePath('style/spot.css'),
|
||||||
'filepath_js_d3' => self::addTimestampToFilePath('script/d3.min.js'),
|
'filepath_js_d3' => self::addTimestampToFilePath('script/d3.min.js'),
|
||||||
'filepath_js_leaflet' => self::addTimestampToFilePath('script/leaflet.min.js'),
|
'filepath_js_leaflet' => self::addTimestampToFilePath('script/leaflet.min.js'),
|
||||||
@@ -328,15 +327,6 @@ class Spot extends Main
|
|||||||
return self::getJsonResult(true, '');
|
return self::getJsonResult(true, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTile($sMapId, $iX, $iY, $iZ)
|
|
||||||
{
|
|
||||||
if(isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] == $this->asContext['serv_name'] || Settings::DEBUG) {
|
|
||||||
$oWmts = new Wmts($sMapId);
|
|
||||||
return $oWmts->pushTile($iX, $iY, $iZ);
|
|
||||||
}
|
|
||||||
else self::goTo403();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function DecToDMS($dValue, $sType='lat') {
|
public static function DecToDMS($dValue, $sType='lat') {
|
||||||
if($sType=='lat') $sDirection = ($dValue >= 0)?'N':'S';
|
if($sType=='lat') $sDirection = ($dValue >= 0)?'N':'S';
|
||||||
else $sDirection = ($dValue >= 0)?'E':'W';
|
else $sDirection = ($dValue >= 0)?'E':'W';
|
||||||
|
|||||||
@@ -44,9 +44,6 @@ if($sAction!='')
|
|||||||
case 'add_post':
|
case 'add_post':
|
||||||
$sResult = $oSpot->addPost($sName, $sContent);
|
$sResult = $oSpot->addPost($sName, $sContent);
|
||||||
break;
|
break;
|
||||||
case 'tile':
|
|
||||||
$sResult = $oSpot->getTile($sId, $iX, $iY, $iZ);
|
|
||||||
break;
|
|
||||||
/*case 'sql':
|
/*case 'sql':
|
||||||
$sResult = $oSpot->getDbBuildScript();
|
$sResult = $oSpot->getDbBuildScript();
|
||||||
break;*/
|
break;*/
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ function initPage(asHash) {
|
|||||||
self.tmp('mobile', $('#mobile').is(':visible'));
|
self.tmp('mobile', $('#mobile').is(':visible'));
|
||||||
self.tmp('feed_width', self.tmp('mobile')?0:$('#feed').outerWidth(true));
|
self.tmp('feed_width', self.tmp('mobile')?0:$('#feed').outerWidth(true));
|
||||||
self.tmp('map_offset', -1 * self.tmp('feed_width') / $('body').outerWidth(true));
|
self.tmp('map_offset', -1 * self.tmp('feed_width') / $('body').outerWidth(true));
|
||||||
self.tmp('tile_api', '?a=tile&id={id}&z={z}&x={x}&y={y}');
|
self.tmp('tile_api', getWmtsApiUrl('{id}', '{y}', '{x}', '{z}'));
|
||||||
self.tmp('markers', 'object');
|
self.tmp('markers', 'object');
|
||||||
self.tmp('marker_size', {width: 32, height: 32});
|
self.tmp('marker_size', {width: 32, height: 32});
|
||||||
|
|
||||||
@@ -434,7 +434,7 @@ function getPost(asPost) {
|
|||||||
.append($('<p>').addIcon('fa-coords', true).append(asPost.lat_dms+' '+asPost.lon_dms))
|
.append($('<p>').addIcon('fa-coords', true).append(asPost.lat_dms+' '+asPost.lon_dms))
|
||||||
.append($('<p>').addIcon('fa-time', true).append(sAbsTime+self.tmp('site_tz_notice')))
|
.append($('<p>').addIcon('fa-time', true).append(sAbsTime+self.tmp('site_tz_notice')))
|
||||||
.append(
|
.append(
|
||||||
$('<img>', {'class':'staticmap', title: 'Click pour zoomer', src: getStaticMapUrl(asPost.latitude, asPost.longitude)})
|
$('<img>', {'class':'staticmap', title: 'Click pour zoomer', src: getWmtsApiUrl('static', asPost.latitude, asPost.longitude, 13)})
|
||||||
.click(function(){
|
.click(function(){
|
||||||
var oMarker = oSpot.tmp(['markers', $(this).parent().data('id')]);
|
var oMarker = oSpot.tmp(['markers', $(this).parent().data('id')]);
|
||||||
self.tmp('map').setOffsetView(self.tmp('map_offset'), oMarker.getLatLng(), 13);
|
self.tmp('map').setOffsetView(self.tmp('map_offset'), oMarker.getLatLng(), 13);
|
||||||
@@ -483,13 +483,7 @@ function getPost(asPost) {
|
|||||||
return $Post;
|
return $Post;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getStaticMapUrl(oCenterLat, oCenterLng) {
|
function getWmtsApiUrl(sMapId, iLat, iLng, iZoom) {
|
||||||
return '?'+$.param({
|
return self.consts.geo_server+'/?a=tile&id='+sMapId+'&z='+iZoom+'&x='+iLng+'&y='+iLat;
|
||||||
'a': 'tile',
|
|
||||||
'id': 'static',
|
|
||||||
'z': 13,
|
|
||||||
'x': oCenterLng,
|
|
||||||
'y': oCenterLat
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
class Settings
|
class Settings
|
||||||
{
|
{
|
||||||
const HOST_SERVER = 'http(s)://your.domain.tld';
|
const GEO_SERVER = 'http(s)://geo.server.tld';
|
||||||
const DB_SERVER = 'localhost';
|
const DB_SERVER = 'localhost';
|
||||||
const DB_LOGIN = '';
|
const DB_LOGIN = '';
|
||||||
const DB_PASS = '';
|
const DB_PASS = '';
|
||||||
|
|||||||
Reference in New Issue
Block a user