braggtown: north durham

About Visitor Map

Purpose

The purpose of the Visitor Map is to provide a visual record of the location of visitors to the Visitor Map page. There are several free applications and services for logging web traffic and this application is not intended to replace those. The motive for this application was to provide a semi-practical project to work on while learning about the Google Maps API.

Technology

This application relies on PHP to communicate with a MySQL database, which stores information including: time of most recent visit; ip address; hostname; city, country; latitude; and longitude; about each visitor. The geocoding information (associating an ip address with geospatial information) is done by sending the ip address to the API of hostip.info, a free geocoding service. The application uses this information to create a set of points to overlay on a map provided by the Google Maps API. The API is written in Javascript.

This application was originally written as a Python CGI and used text files to store the XML used to generate the points overlayed on the Google map. I wanted the application to be more flexible and to scale well so I rewrote it in PHP/MySQL. In the future I may add display options such as 'Show last x number of visitors' (it's currently hard-coded to 30) or 'order results by a specific attribute'. A form in which people can enter their own geospatial information my make the results more accurate, but would probably be subject to abuse.

Issues

Currently, there are two major outstanding issues. First, the results from hostip.info are not entirely accurate or not available. The service is free and, as such, one can't expect it to provide perfect information for every ip address. It seems that international ip address are exceptionally hit-or-miss. Second, the differences in the way that the page is rendered in various browsers is truly annoying. The combination of the inflexibility of interoperation between the Javascript API and CSS and the added layer of complexity of the PHP application wrapper make it quite difficult to control the display with any granularity.

Download the code
Return to the Vistor Map