GeoMap
GeoMap is a hit counter for your web site that tracks the latitude and longitude of each visit and displays a cluster map of the world to show where your visitors are coming from.Current Version
2008-09-05 19:14:01 NEW
Note that you can check the version of a web gadget by loading it directly in your browser with the "version" keyword. For example, loading "ingeomap.php?version" will display the current version and tell you if there is a newer version available.
Installation
To install this web gadget, place a copy of ingeomap.php in your web space. You can change the name to anything you'd like, as long as it ends with ".php". Note that this is an encoded and encrypted PHP file. It will look like gibberish to you, but the web server will know what to do with it. If you make any changes to this file it will cease to function, so be careful to upload it to your site in BINARY mode.
You also need to place one of the map images from the end of this document into the same location as the ingeomap.php file.
Configuration
When this web gadget runs it will expect to find a configuration file to load settings from. The filename depends on the name that you gave to the web gadget itself. If you named it "ingeomap.php" then the configuration file must be named "ingeomap_config.php" (that's an underscore in the middle). If you named it "feedback.php" then the configuration file must be named "feedback_config.php", and so on.
The configuration file is a PHP script that contains a list of values in the "CONFIG" array. It will look something like this (but normally with many more settings):
$CONFIG['MapID'] = 1; |
Please note that this is a PHP file, and as such it must start with the tag and end with the ?> tag and there must be nothing else before or after these tags and each setting must be terminated with a semicolon. String values need to be enclosed in quotes, numeric values do not need quotes. Putting any other PHP code in this file may cause the web gadget to function incorrectly.
Configuration Settings
- $CONFIG['MapID']
- This is a number between 0 and 255 that uniquely identifies this particular GeoMap in the database. The default is 0 and you only need to set this if you have more than one GeoMap sharing the same database.
- $CONFIG['MapImage']
- This is the filename of the map image to use. You can supply your own world map image (it must be exactly 1440 x 720 pixels in size, centered on 0' latitude and 0' longitude), or choose from several that are available at the end of this page.
- $CONFIG['Levels']
- This is a number that specifies how many different dot sizes will be used. Normally you will just leave this set to 0, which will cause the web gadget to calculate a suitable number automatically.
- $CONFIG['MinSize']
- This is the size of the smallest dots that will appear on the map. Anything smaller than 3 won't be very visible, and a value between 5 and 10 is recommended. The default value is 3.
- $CONFIG['MaxSize']
- This is the size of the largest dots that will appear on the map. A good value is between 30 and 50. There should be a big enough difference between the MinSize and MaxSize values to make them distinguishable. This value may be increased automatically by the web gadget depending on the requested detail level, so it's a rough value. The default value is 40.
- $CONFIG['Color']
- This is a HTML style color (eg: FFFF00 for yellow, or 00FF00 for green) for the dots on the map. Dots will also be outlined in black. The default value is 'FF0000' (red)
- $CONFIG['SmallDotsOnTop']
- By default, dots are sorted such that the larger dots overlap the smaller ones, which makes for a less "messy" display. If you set this value to "yes" then the dots will be sorted in reverse, causing the smaller dots to overlap the larger ones.
- $CONFIG['CacheDirectory']
- This is the name of a directory where the web gadget can cache data between invocations. This value must be set to a directory that exists and is writable, otherwise the web gadget will not run.
- $CONFIG['MySQLHostname'], $CONFIG['MySQLUsername'], $CONFIG['MySQLPassword'], $CONFIG['MySQLDatabase']
- These settings provide the hostname, username, password, and database name for a MySQL database. This database is used by this web gadget to track hits. You must create this database, but you do not need to create any tables in it as the web gadget will automatically create what it needs. It is recommended that you create one database and use it for all your web gadget configurations (as opposed to creating a new database for each web gadget).
- $CONFIG['MySQLTablePrefix']
- Normally this value will be left empty, but if you are using an existing database and you want to make sure that there are no table name conflicts, this value will be prepended to the name of any tables used by the web gadget.
Usage:
This gadget can be invoked in several ways. If you simply load it directly in a web browser, it will default to an interactive mode where a map of the whole world is shown, and clicking on the continents will zoom in on them. The counter will not be incremented in interactive mode, it is meant for viewing the current GeoMap.
To record hits and increment the counter, you'll want to embed a link to this gadget on one or more web pages on your site. This is generally done through the use of an image tag like this:
Specifying "display=invisible" will cause the web gadget to output a 1x1 transparent GIF image (ie: it's invisible). The "count=yes" parameter causes it to increment the counter.
If you prefer to actually display a map, you can use a link like this instead:
The "display=map" option causes the gadget to output a world map with dots on it. The "width=120" parameter controls the width of the map in pixels. You can specify any value up to 1,440. For example, here's this site's GeoMap at 300 pixels wide:
Of course, you can choose to display the map without incrementing the counter by leaving off the "count=yes" bit.
You can display a particular continent by ading "area=XX" where XX is one of 'na' (North America), 'sa' (South America), 'eu' (Europe), 'af' (Africa), 'as' (Asia), or 'au' (Australia). For example, here's North America:
You can also control the "clustering detail" to a degree by adding "detail=N" where N is a number from 0 to 10. The lower this number, the more distinct the hits will be, which generates more dots. As this number increases, hits that are close together geographically are merged together into a bigger dot, resulting in fewer overall dots. For example, here is a lower detail version of the image above:
Two additional optional parameters are "counter=yes" and "date="yes". If these are added, the current counter value is added to the top of the image, and the start date of the counter is added to the bottom. For example:
And finally, here's some HTML you can cut and paste into your web site to display a GeoMap counter which is click-able (after installing and configuring a copy of GeoMap of course):
If you add "count=yes" to the
Example:
To view a working example, click here.
To view the configuration file used in this example, click here.
Alternative Map Images:
Copy one of these map images into the same directory as your ingeomap.php file and put the file name in the $CONFIG['MapImage'] setting. If you choose to supply your own map image, make sure that it is exactly 1440 x 720 pixels in size, and centered on 0' latitude, 0' longitude, just like these. Click on a map below to view/download the full size 1440 x 720 image:
Map #1 |
Map #2 |
Map #3 |
---|---|---|
Map #4 |
Map #5 |
Map #6 |
Map #7 |
Map #8 |
Map #9 |
Map #10 |
Map #11 |
Map #12 |
Map #13 |
Map #14 |
Map #15 |
Map #16 |
Map #17 |
Map #18 |
Map #19 |
Map #20 |
Map #21 |
Map #22 |
Map #23 |
Map #24 |
Map #25 |