Pick project from globe

This commit is contained in:
2026-05-13 23:28:36 +02:00
parent c3835f45c5
commit 49f37465bd
9 changed files with 151 additions and 78 deletions

View File

@@ -103,7 +103,6 @@ class GeoJson extends Geo {
if($bSimplify) $this->addNotice('Total: '.$iGlobalInvalidPointCount.'/'.$iGlobalPointCount.' points removed ('.round($iGlobalInvalidPointCount / $iGlobalPointCount * 100, 1).'%)');
}
public function sortOffTracks() {
$this->addNotice('Sorting off-tracks');
@@ -155,7 +154,19 @@ class GeoJson extends Geo {
$this->asTracks = array_values($asTracks);
}
private function parseOptions($sComment){
public function getCenter() {
$asCoords = array();
$asMainTracks = array_filter($this->asTracks, function ($astrack) {return $astrack['properties']['type'] == 'main';});
foreach($asMainTracks as $asMainTrack) {
foreach($asMainTrack['geometry']['coordinates'] as $aiCoords) {
$asCoords[] = $aiCoords;
}
}
return $asCoords[(int) floor(count($asCoords) / 2)];
}
private function parseOptions($sComment) {
$sComment = strip_tags(html_entity_decode($sComment));
$asOptions = array(self::OPT_SIMPLE=>'');
foreach(explode("\n", $sComment) as $sLine) {