Skip to content
This repository was archived by the owner on Oct 5, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ <h2>
staticMapLite - simple map for your website
</h2>
<p>
<img src="staticmap.php?center=40.714728,-73.998672&zoom=14&size=865x512&maptype=mapnik" width="865" height="512" /></p>
<img src="staticmap.php?center=40.714728,-73.998672&zoom=14&size=865x512&maptype=standard" width="865" height="512" /></p>
<p>
This image was created using the following simple &lt;img> tag:
<pre>&lt;img src="staticmap.php?center=40.714728,-73.998672&amp;zoom=14&amp;size=865x512&amp;maptype=mapnik" /&gt;</pre>
<pre>&lt;img src="staticmap.php?center=40.714728,-73.998672&amp;zoom=14&amp;size=865x512&amp;maptype=standard" /&gt;</pre>
</p>
</div>
<hr />
Expand All @@ -83,7 +83,7 @@ <h3>
</h3>

<p>
<img src="staticmap.php?center=40.714728,-73.998672&zoom=14&size=865x512&maptype=mapnik&markers=40.702147,-74.015794,lightblue1|40.711614,-74.012318,lightblue2|40.718217,-73.998284,lightblue3" width="865" height="512" />
<img src="staticmap.php?center=40.714728,-73.998672&zoom=14&size=865x512&maptype=standard&markers=40.702147,-74.015794,lightblue1|40.711614,-74.012318,lightblue2|40.718217,-73.998284,lightblue3" width="865" height="512" />
</p><p> Add markers by appending them to the image URL:
<pre>markers=40.702147,-74.015794,lightblue1|40.711614,-74.012318,lightblue2|40.718217,-73.998284,lightblue3</pre>
</p>
Expand All @@ -96,12 +96,8 @@ <h3>

<p>
<div style="float:left; margin-right: 10px">
<img src="staticmap.php?center=40.714728,-73.998672&zoom=14&size=256x256&maptype=mapnik" width="256" height="256" />
<pre>maptype=mapnik</pre>
</div>
<div style="float:left; margin-right: 10px">
<img src="staticmap.php?center=40.714728,-73.998672&zoom=14&size=256x256&maptype=osmarenderer" width="256" height="256" />
<pre>maptype=osmarenderer</pre>
<img src="staticmap.php?center=40.714728,-73.998672&zoom=14&size=256x256&maptype=standard" width="256" height="256" />
<pre>maptype=standard</pre>
</div>
<div style="float:left; margin-right: 10px">
<img src="staticmap.php?center=40.714728,-73.998672&zoom=14&size=256x256&maptype=cycle" width="256" height="256" />
Expand All @@ -119,4 +115,4 @@ <h3>
</div>
</div>
</body>
</html>
</html>
18 changes: 13 additions & 5 deletions staticmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
* USAGE:
*
* staticmap.php?center=40.714728,-73.998672&zoom=14&size=512x512&maptype=mapnik&markers=40.702147,-74.015794,blues|40.711614,-74.012318,greeng|40.718217,-73.998284,redc
* staticmap.php?center=40.714728,-73.998672&zoom=14&size=512x512&maptype=standrd&markers=40.702147,-74.015794,blues|40.711614,-74.012318,greeng|40.718217,-73.998284,redc
*
*/

Expand All @@ -35,12 +35,18 @@
protected $maxHeight = 1024;

protected $tileSize = 256;
protected $tileSrcUrl = array('mapnik' => 'http://tile.openstreetmap.org/{Z}/{X}/{Y}.png',
'osmarenderer' => 'http://otile1.mqcdn.com/tiles/1.0.0/osm/{Z}/{X}/{Y}.png',
protected $tileSrcUrl = array(
'standard' => 'http://tile.openstreetmap.org/{Z}/{X}/{Y}.png',
'cycle' => 'http://a.tile.opencyclemap.org/cycle/{Z}/{X}/{Y}.png',
);

protected $tileDefaultSrc = 'mapnik';
// Deprecated map_type values still supported as aliases
protected $mapTypeAliases = array(
'mapnik' => 'standard',
'osmarender' => 'standard'
);

protected $tileDefaultSrc = 'standard';
protected $markerBaseDir = 'images/markers';
protected $osmLogo = 'images/osm_logo.png';

Expand Down Expand Up @@ -142,7 +148,9 @@ public function parseLiteParams()

}
if ($_GET['maptype']) {
if (array_key_exists($_GET['maptype'], $this->tileSrcUrl)) $this->maptype = $_GET['maptype'];
$mapTypeParam = $_GET['maptype'];
if (array_key_exists($mapTypeParam, $this->mapTypeAliases)) $mapTypeParam = $this->mapTypeAliases[$mapTypeParam];
if (array_key_exists($mapTypeParam, $this->tileSrcUrl)) $this->maptype = $mapTypeParam;
}
}

Expand Down