This repository has been archived by the owner on Oct 5, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from mores/StaticMap_dropIn
Can now act as dropIn replacement for StaticMap by ojw
- Loading branch information
Showing
2 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,8 +65,14 @@ | |
'shadow' => '../marker_shadow.png', | ||
'offsetImage' => '-10,-32', | ||
'offsetShadow' => '-1,-13' | ||
), | ||
// http://svn.openstreetmap.org/sites/other/StaticMap/symbols/0.png | ||
'ojw' => array('regex' => '/^bullseye$/', | ||
'extension' => '.png', | ||
'shadow' => false, | ||
'offsetImage' => '-20,-20', | ||
'offsetShadow' => false | ||
) | ||
|
||
); | ||
|
||
|
||
|
@@ -97,6 +103,16 @@ public function parseParams() | |
{ | ||
global $_GET; | ||
|
||
if (!empty($_GET['show'])) { | ||
$this->parseOjwParams(); | ||
} | ||
else { | ||
$this->parseLiteParams(); | ||
} | ||
} | ||
|
||
public function parseLiteParams() | ||
{ | ||
// get zoom from GET paramter | ||
$this->zoom = $_GET['zoom'] ? intval($_GET['zoom']) : 0; | ||
if ($this->zoom > 18) $this->zoom = 18; | ||
|
@@ -130,6 +146,24 @@ public function parseParams() | |
} | ||
} | ||
|
||
public function parseOjwParams() | ||
{ | ||
$this->lat = floatval($_GET['lat']); | ||
$this->lon = floatval($_GET['lon']); | ||
$this->zoom = intval($_GET['z']); | ||
|
||
$this->width = intval($_GET['w']); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
dfacts
via email
Author
Owner
|
||
$this->height = intval($_GET['h']); | ||
|
||
if (!empty($_GET['mlat0'])) { | ||
$markerLat = floatval($_GET['mlat0']); | ||
if (!empty($_GET['mlon0'])) { | ||
$markerLon = floatval($_GET['mlon0']); | ||
$this->markers[] = array('lat' => $markerLat, 'lon' => $markerLon, 'type' => "bullseye"); | ||
} | ||
} | ||
} | ||
|
||
public function lonToTile($long, $zoom) | ||
{ | ||
return (($long + 180) / 360) * pow(2, $zoom); | ||
|
@@ -369,4 +403,4 @@ public function showMap() | |
} | ||
|
||
$map = new staticMapLite(); | ||
print $map->showMap(); | ||
print $map->showMap(); |
should we test w & h against max sizes like done at https://github.com/dfacts/staticmaplite/blob/master/staticmap.php#L129 ?