Skip to content
This repository has been archived by the owner on Oct 5, 2018. It is now read-only.

Commit

Permalink
Merge pull request #1 from mores/StaticMap_dropIn
Browse files Browse the repository at this point in the history
Can now act as dropIn replacement for StaticMap by ojw
  • Loading branch information
dfacts committed Dec 15, 2014
2 parents f5ee38f + 53fa33a commit 8dab382
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
Binary file added images/markers/bullseye.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 36 additions & 2 deletions staticmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

);


Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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.

Copy link
@brunob

brunob Oct 16, 2015

Contributor

should we test w & h against max sizes like done at https://github.com/dfacts/staticmaplite/blob/master/staticmap.php#L129 ?

This comment has been minimized.

Copy link
@dfacts

dfacts via email Oct 16, 2015

Author Owner

This comment has been minimized.

Copy link
@brunob

brunob Oct 17, 2015

Contributor

done with #4 :)

$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);
Expand Down Expand Up @@ -369,4 +403,4 @@ public function showMap()
}

$map = new staticMapLite();
print $map->showMap();
print $map->showMap();

0 comments on commit 8dab382

Please sign in to comment.