view the website - strange things in Google Maps and Google Earth View the Map
 


New Server

Filed under: mapofstrange.com — Paul March 25, 2008 @ 12:09 pm

The website has been down a lot recently. I suppose we’ve been a victim of our own success - it was because we’ve been getting lots more traffic than we ever expected (sorry for any inconvenience, and thanks for your support). We’ve been on Digg.com, we’ve been stumbled, and we’ve even been on German TV, and as such we’ve ended up taking up too much of the CPU on our host’s servers. And we’ve done that lots of times. 

But we’ve moved to a new server. This one is a VPS, so it should (we’ll keep our fingers crossed) stay up (although it’s already been taken down once for hitting the database too frequently). The VPS does mean, however, that we can add a load more functionality - so watch this space. We’ve already reintroduced comments and ratings, and we’ll be bringing back the search fairly soon.  We’re also going to add the ability to search in a particular area.  All that is coming soon, and if you have any other suggestions, we’d love to hear them - paul@mapofstrange.com with your suggestions.



Google Maps static API

Filed under: Google Maps API, mapofstrange.com — Paul March 19, 2008 @ 12:30 pm

Google have released a new API for Google Maps.  This is really different - it doesn’t require Javascript - it’s static.  Simply pass some parameters to a URL and it returns a gif image of the location in question.  For more information read their blog entry - http://googlemapsapi.blogspot.com/2008/02/google-maps-without-scripting.html.

The way mapofstrange.com works is designed to be interactive, so I can’t see me replacing the entire feel with this non-Javascript method, but it still  might have some really useful application at mapofstrange.com.  If we don’t need Javascript, it could be a good way of providing a mobile service.    Or I could have an ‘add this to your webpage’ link which generates the code to display an image. 

 At present it only shows map-level images and not satellite imagery, which means that it isn’t right for mapofstrange.com (at least not yet).  It’s definitely something I’m going to keep my eye on though… 

It is incredibly easy to setup - there is even a wizard - http://gmaps-samples.googlecode.com/svn/trunk/simplewizard/makestaticmap.html.  Just do a search for the location, choose the zoom level and the size of the map, and it generates the map for you.  At the moment there is a maximum of 1000 page views per person (not per image or per key) per day, which is ample, but I expect that this will increase over time. 

 Here’s an example of it in action (click on it to open the map) -

static map - click to view

Altogether, I think it’s an excellent addition to the Google Maps API - I only wish it would show satellite images as well!



Server issues

Filed under: mapofstrange.com — Paul March 5, 2008 @ 12:28 pm

The success of mapofstrange.com has caused no end of problems! Every host it’s been on over the past year has told us where to go. We’ve been told in no uncertain terms to move to a different host or sign up for a dedicated server. The problem is that it keeps bringing the server down, which isn’t exactly pleasant for other people who are being hosted on that server…

We recently migrated to a VPS (Virtual Private Server), which essentially means that we’ve got full control over the hosting of the site - if the server goes down it’s up to us to fix it. Unfortunately, the server has been going down. A lot. Every couple of days the site just dissappears. What had happened was that Apache had somehow managed to fall over. The fix for this was relatively straightforward. A simple cron job running every minute of every day checks to see if the site is running and if it isn’t, it restarts Apache.

The script that does this is a python script -

import httplib, os
try:
  conn = httplib.HTTPConnection(”www.mapofstrange.com”)
  conn.request(”GET”, “/index.php”)
  r1 = conn.getresponse() #can it get a response from mapofstrange.com

except:
  #Restart Apache
  try:
  os.system(’sh /etc/init.d/httpd restart’)
  print “Apache restarted successfully”

except:
  print “Failed to restart Apache”

This does a quick check (using httplib) to see if it can connect to the server. If it can’t it simply trys to restart Apache. You can also set it up to restart other services like MySQL (os.system('sh /etc/init.d/mysql restart') ). We’re lucky that we’ve got cpanel running, as it provides us with these scripts to restart essential services under etc/init.d.  We saved this onto the server, then setup the cron job to run this script every minute. To get the cron job to work, we simply added the following line to the root cron file under /var/spool/cron in my file system.

* * * * * python /tmp/restart.py

We also got it to email us the results, so we know when it’s gone down and how quickly it managed to restart.

The site/server still goes down (probably about once a day), but it’s only ever down for a minute (or two if there is a serious problem). This really simple solution means that we don’t have to concern ourselves with server admin on a regular basis - the biggest issue is automatically taken care of by the system itself.