Adding Cities

The "Ask Felgall" guestmap not only allows you to use your own map image but you can also dynamically overlay your own city markers onto the map without having to change the map image that you are using.

To do this you must first determine the coordinates on the map where the particular city is located. The easiest way to do this is to temporarily add a comment to the map that marks the location where you want the city marker to appear. Once this is added you then go into the administration function and Edit the entry that you temporarily added. This will now display at the top of the page in the editable fields with the Spot values showing you the location of the marker on the map. make a note of these values and then Delete the temporary entry.

The spot location marks the centre of the marker so the top/left location of the marker that you want to insert will probably be about 2 or 3 less for each value, you may need to experiment with minor changes in order to get the city marker exactly where you want it but at least you now have values fairly close to what you need.

Next open the inc/guestcty.php file in your editor. You now need to add a line to the file immediately above the ?> at the bottom of the file. The entry that you are adding will look something like this (with your own city name, top, left, and marker colours substituted):


The values shown in this example are those required to place a black city marker for Sydney, Australia on the supplied map. You need to specify the name of the city that you are placing and want to appear on the map along with the top and left positions you recorded before (perhaps subtract 2 from each to start with) and select a colour out of black, blue, brown, green, grey, orange, purple, and red.

Repeat the above steps for any additional cities that you want to add to the map.

Once all cities are added you then save your file to the server and then view the map (press CTRL-F5 to refresh it). If any cities are not displaying in quite the right positions you can make minor adjustments by altering the numbers for the top and left positions by reducing the numbers slightly to move the marker up or left and increasing them slightly to move the markers down or right.

The cities that you specify will be displayed over the map in the same way that the markers placed by visitors to your site are displayed over the map. If you should later decide to chang which cities you are displaying on the map you will be able to do so by editing the inc/guestcty.php file instead of having to edit your map image.


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow