commit
b3c0c5b32e
@ -18,5 +18,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"require": {}
|
"require": {
|
||||||
|
"emcconville/google-map-polyline-encoding-tool": "^1.3"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
63
composer.lock
generated
Normal file
63
composer.lock
generated
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
{
|
||||||
|
"_readme": [
|
||||||
|
"This file locks the dependencies of your project to a known state",
|
||||||
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
|
"This file is @generated automatically"
|
||||||
|
],
|
||||||
|
"content-hash": "d182917c77cf8a8483700b6913cd7277",
|
||||||
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "emcconville/google-map-polyline-encoding-tool",
|
||||||
|
"version": "v1.3",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/emcconville/google-map-polyline-encoding-tool.git",
|
||||||
|
"reference": "dbf3816936620b88f0fc4000fddd94b5ce13eadb"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/emcconville/google-map-polyline-encoding-tool/zipball/dbf3816936620b88f0fc4000fddd94b5ce13eadb",
|
||||||
|
"reference": "dbf3816936620b88f0fc4000fddd94b5ce13eadb",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "4.1.*",
|
||||||
|
"satooshi/php-coveralls": "dev-master",
|
||||||
|
"squizlabs/php_codesniffer": "2.0.0a2"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"src/Polyline.php"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"GNU"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Eric McConville",
|
||||||
|
"email": "emcconville@emcconville.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A simple class to handle polyline-encoding for Google Maps",
|
||||||
|
"keywords": [
|
||||||
|
"google",
|
||||||
|
"maps"
|
||||||
|
],
|
||||||
|
"time": "2016-04-05T01:18:39+00:00"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"packages-dev": [],
|
||||||
|
"aliases": [],
|
||||||
|
"minimum-stability": "stable",
|
||||||
|
"stability-flags": [],
|
||||||
|
"prefer-stable": false,
|
||||||
|
"prefer-lowest": false,
|
||||||
|
"platform": [],
|
||||||
|
"platform-dev": []
|
||||||
|
}
|
@ -52,13 +52,13 @@ class staticMapLite
|
|||||||
protected $useTileCache = true;
|
protected $useTileCache = true;
|
||||||
protected $tileCacheBaseDir = '../cache/tiles';
|
protected $tileCacheBaseDir = '../cache/tiles';
|
||||||
|
|
||||||
protected $useMapCache = true;
|
protected $useMapCache = false;
|
||||||
protected $mapCacheBaseDir = '../cache/maps';
|
protected $mapCacheBaseDir = '../cache/maps';
|
||||||
protected $mapCacheID = '';
|
protected $mapCacheID = '';
|
||||||
protected $mapCacheFile = '';
|
protected $mapCacheFile = '';
|
||||||
protected $mapCacheExtension = 'png';
|
protected $mapCacheExtension = 'png';
|
||||||
|
|
||||||
protected $zoom, $lat, $lon, $width, $height, $markers, $image, $maptype;
|
protected $zoom, $lat, $lon, $width, $height, $markers, $polylines, $image, $maptype;
|
||||||
protected $centerX, $centerY, $offsetX, $offsetY;
|
protected $centerX, $centerY, $offsetX, $offsetY;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@ -114,6 +114,10 @@ class staticMapLite
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (!empty($_GET['polylines'])) {
|
||||||
|
list($polylineString, $colorRed, $colorGreen, $colorBlue) = explode(',', $_GET['polylines']);
|
||||||
|
$this->polylines[] = array('polyline' => $polylineString, 'colorRed' => $colorRed, 'colorGreen' => $colorGreen, 'colorBlue' => $colorBlue);
|
||||||
|
}
|
||||||
if ($_GET['maptype']) {
|
if ($_GET['maptype']) {
|
||||||
if (array_key_exists($_GET['maptype'], $this->tileSrcUrl)) $this->maptype = $_GET['maptype'];
|
if (array_key_exists($_GET['maptype'], $this->tileSrcUrl)) $this->maptype = $_GET['maptype'];
|
||||||
}
|
}
|
||||||
@ -257,6 +261,52 @@ class staticMapLite
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function placePolylines()
|
||||||
|
{
|
||||||
|
// loop thru marker array
|
||||||
|
foreach ($this->polylines as $polyline) {
|
||||||
|
// set some local variables
|
||||||
|
$polylineString = $polyline['polyline'];
|
||||||
|
$colorRed = $polyline['colorRed'];
|
||||||
|
$colorGreen = $polyline['colorGreen'];
|
||||||
|
$colorBlue = $polyline['colorBlue'];
|
||||||
|
|
||||||
|
$polylineList = \Polyline::decode($polylineString);
|
||||||
|
|
||||||
|
$sourceLatitude = null;
|
||||||
|
$sourceLongitude = null;
|
||||||
|
$destinationLatitude = null;
|
||||||
|
$destinationLongitude = null;
|
||||||
|
|
||||||
|
$color = imagecolorallocate($this->image, $colorRed, $colorGreen, $colorBlue);
|
||||||
|
imagesetthickness($this->image, 3);
|
||||||
|
//imageantialias($this->image, true);
|
||||||
|
|
||||||
|
while (!empty($polylineList)) {
|
||||||
|
if (!$sourceLatitude) {
|
||||||
|
$sourceLatitude = array_shift($polylineList);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$sourceLongitude) {
|
||||||
|
$sourceLongitude = array_shift($polylineList);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sourceX = floor(($this->width / 2) - $this->tileSize * ($this->centerX - $this->lonToTile($sourceLongitude, $this->zoom)));
|
||||||
|
$sourceY = floor(($this->height / 2) - $this->tileSize * ($this->centerY - $this->latToTile($sourceLatitude, $this->zoom)));
|
||||||
|
|
||||||
|
$destinationLatitude = array_shift($polylineList);
|
||||||
|
$destinationLongitude = array_shift($polylineList);
|
||||||
|
|
||||||
|
$destinationX = floor(($this->width / 2) - $this->tileSize * ($this->centerX - $this->lonToTile($destinationLongitude, $this->zoom)));
|
||||||
|
$destinationY = floor(($this->height / 2) - $this->tileSize * ($this->centerY - $this->latToTile($destinationLatitude, $this->zoom)));
|
||||||
|
|
||||||
|
imageline($this->image , $sourceX, $sourceY , $destinationX, $destinationY, $color);
|
||||||
|
|
||||||
|
$sourceLatitude = $destinationLatitude;
|
||||||
|
$sourceLongitude = $destinationLongitude;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function tileUrlToFilename($url)
|
public function tileUrlToFilename($url)
|
||||||
{
|
{
|
||||||
@ -342,6 +392,7 @@ class staticMapLite
|
|||||||
$this->initCoords();
|
$this->initCoords();
|
||||||
$this->createBaseMap();
|
$this->createBaseMap();
|
||||||
if (count($this->markers)) $this->placeMarkers();
|
if (count($this->markers)) $this->placeMarkers();
|
||||||
|
if (count($this->polylines)) $this->placePolylines();
|
||||||
if ($this->osmLogo) $this->copyrightNotice();
|
if ($this->osmLogo) $this->copyrightNotice();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
7
web/info.php
Normal file
7
web/info.php
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: maltehuebner
|
||||||
|
* Date: 26.05.17
|
||||||
|
* Time: 15:09
|
||||||
|
*/
|
Loading…
Reference in New Issue
Block a user