At a quick glance, have you noticed the $filename is expecting to output a link in the following format:
$filename = /var/www/merge/tiles/zoom_x_y.png But your files appear to me to be organised into something like /var/ www/merge/tiles/zoom/x/y.png ? Take a closer look at the $filename, I suspect you need to change it a bit (look at the . "_" . parts especially). Let me know how it goes. On Jul 30, 8:50 pm, Jason <jason.wool...@gmail.com> wrote: > Thanks for posting that Kesuke! It would be great to get this working. > Those 404s have been a headache for quite a while. > > I've implemented your example on a small test page and I'm not seeing > any tiles. I'm not too familiar with PHP but I did check that safe > mode is "off" with phpinfo. > > My php looks like this: > > <?php > $filename = "/var/www/merge/tiles/" . intval($_GET['z']) . > "_" .intval($_GET['x']) . "_" . intval($_GET['y']) . ".png"; > > header("Content-Type: image/png"); > header("Cache-Control: max-age=84600"); > > if (file_exists($filename)) { > header("Content-Length: " . filesize($filename)); > readfile($filename); > } else { > readfile("/var/www/merge/tiles/clear.png"); > } > ?> > > the tiles are at: > > http://69.164.209.124/merge/tiles/ > > and the page is here: > > http://69.164.209.124/merge/mimagery.html > > Any idea what I'm missing here? > > Thanks in advance for a steer in the right direction. > > On Jul 30, 10:19 am, Kesuke <nick_dai...@hotmail.com> wrote: > > > > > Okay, thanks everyone – the PHP solution works great! > > So here is a guide for Jason or anyone else who stumbles across this; > > > 1.) Make a new PHP file with the following code: > > > <?php > > > $filename = "/usr/www/httpdocs/tiles/" . intval($_GET['z']) . "_" . > > intval($_GET['x']) . "_" . intval($_GET['y']) . ".png"; > > > header("Content-Type: image/png"); > > header("Cache-Control: max-age=84600"); > > > if (file_exists($filename)) { > > header("Content-Length: " . filesize($filename)); > > readfile($filename); > > } else { > > readfile("/usr/www/httpdocs/clear.png"); > > } > > > ?> > > > Basically this PHP script will check to see if the file exists. If it > > does it will return the file. If it doesn't, it will return a 1px > > empty image, in this case called 'clear.png'. The only stuff you > > should need to change are the paths to clear.png and $filename. Be > > aware that PHP safe mode can probably screw this up. > > > NOTE: counter-intuitively, PHP looks for the true file destination NOT > > the URL. So you need to know your servers C:// style path to the file. > > There are ways around it using fopen() but you would need to look > > those up - not realising this gave me headaches. > > > 2.) Now, go into your map javascript and point to the PHP file instead > > of the image URL. Specify the zoom/x/y co-ords which we will detect > > using $_GET in our PHP script. If you don’t know what $_GET is have a > > look on google as its quite fundamental – but in basic terms you send > > variables and their values to a PHP document by appending the URL with > > the format “map.html/?var=value&othervar=value”. PHP then plucks those > > values and variables out for you to use. > > > So, using the above example: > > > function createImageMapType(id) { > > return new google.maps.ImageMapType({ > > getTileUrl: function(coord, zoom) { > > return "/tilefinder.php?z=" + zoom + "&x=" + coord.x + "&y=" + > > coord.y; > > }, > > tileSize: new google.maps.Size(256, 256), > > isPng: true, > > opacity: true > > }); > > } > > > I hope this helps. So far it seems to be working well on my site, > > there is a noticable improvement in load times and my Google PageSpeed > > score got pushed up by about 20-30 points. If you want to improve > > things further, I suggest setting a higher max-age (probably of 28 > > days/2419200) and also adding a last modified content-type header. > > > On Jul 30, 12:52 am, John Coryat <cor...@gmail.com> wrote: > > > > On Friday, July 29, 2011 6:20:03 PM UTC-5, Jason wrote: > > > > > Sorry for the noob question but does this require any other > > > > configuration changes (ie. htaccess)? I've included this in my > > > > index.html and it is still showing 404 errors in Chrome. > > > > > Thanks > > > > You'll have to be more specific. What did you try? What's the URL of your > > > map? > > > > -John Coryat- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to google-maps-js-api-v3@googlegroups.com. To unsubscribe from this group, send email to google-maps-js-api-v3+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.