Use cloudmade tiles for static maps
--- a/aws/awsStartup.sh
+++ b/aws/awsStartup.sh
@@ -5,6 +5,7 @@
#http://www.how2forge.org/installing-lighttpd-with-php5-and-mysql-support-on-fedora-12
cp /root/aws.php /tmp/
+mkdir /var/www/lib/staticmaplite/cache
chcon -h system_u:object_r:httpd_sys_content_t /var/www
chcon -R -h root:object_r:httpd_sys_content_t /var/www/*
chcon -R -t httpd_sys_content_rw_t /var/www/lib/staticmaplite/cache
--- a/include/common-geo.inc.php
+++ b/include/common-geo.inc.php
@@ -47,7 +47,7 @@
}
$output = "";
if ($collapsible) $output.= '<div data-role="collapsible" data-collapsed="true"><h3>Open Map...</h3>';
- $output.= '<center><img src="' . curPageURL() . 'lib/staticmaplite/staticmap.php?center=' . $center . '&zoom=' . $zoom . '&size=' . $width . 'x' . $height . '&maptype=mapnik&markers=' .
+ $output.= '<center><img src="' . curPageURL() . 'lib/staticmaplite/staticmap.php?center=' . $center . '&zoom=' . $zoom . '&size=' . $width . 'x' . $height . '&markers=' .
$markers . '" width=' . $width . ' height=' . $height . '></center>';
if ($collapsible) $output.= '</div>';
return $output;
--- a/lib/staticmaplite/staticmap.php
+++ b/lib/staticmaplite/staticmap.php
@@ -32,11 +32,9 @@
protected $tileSize = 256;
protected $tileSrcUrl = array( 'mapnik' => 'http://tile.openstreetmap.org/{Z}/{X}/{Y}.png',
- 'osmarenderer' => 'http://c.tah.openstreetmap.org/Tiles/tile/{Z}/{X}/{Y}.png',
- 'cycle' => 'http://c.andy.sandbox.cloudmade.com/tiles/cycle/{Z}/{X}/{Y}.png'
- );
-
- protected $tileDefaultSrc = 'mapnik';
+ 'cloudmade' => 'http://b.tile.cloudmade.com/daa03470bb8740298d4b10e3f03d63e6/1/256/{Z}/{X}/{Y}.png',);
+
+ protected $tileDefaultSrc = 'cloudmade';
protected $markerBaseDir = 'images/markers';
protected $osmLogo = 'images/osm_logo.png';
@@ -258,8 +256,10 @@
} else {
// no cache, make map, send headers and deliver png
$this->makeMap();
- $this->sendHeader();
- return imagepng($this->image);
+ // $this->sendHeader();
+ // do some extra compression
+ imagetruecolortopalette($this->image, false, 256);
+ return imagepng($this->image, 9, PNG_ALL_FILTERS);
}
}