Integrating KML into Google Maps

Posted: December 31st, 2007
 

After getting a GPS unit over the holidays, I was keen to try mapping out a hiking trail on the Vancouver Trails site. After importing the tracks into MapSource and cleaning a few points up, I saved the file in .gpx format and imported that into Google Earth. It looked great!

From here, I could right-click on the data folder and export it to .kml or .kmz format.

To integrate KML files into Google Maps on your website, add the following lines of javascript after the map.addControl calls:

var kml = new GGeoXml("kml-file.kml");
map.addOverlay(kml);

The first file that I exported to .kml from Google Earth was over 250K and included thousands of lines of useless style code. So, I exported the Tracks as one file and then the Waypoints as another file and used the code above twice, once to load each file. Both of those files combined were much smaller at just 21K combined.

The only thing left was to export everything into one .kmz file and provide a link under the map so that users could click and the link would open the map into Google Earth automatically. Click here to open the Capilano Canyon file in Google Earth.

Capilano Canyon Map

 

What to Look for in Your Web Stats

Posted: December 30th, 2007
 

Most webmasters are usually analytics tools such as Google Analytics, Web Trends, or ClickTracks to measure the traffic to their websites. But what information is the most useful? The following are a few basic tips to follow:

  1. The number of visits is important and is best looked at over a monthly basis. You can also segment the number of visitors into time ranges based on campaigns you might be running.
  2. Determining where your traffic is coming from can be found through the referrers. The list of referrers shows which websites visits reach your site from. Additionally, looking at the bounce rate of each can determine how valuable one referrer is compared with another.
  3. Studying the keywords that users type into search engines to reach your site can help you tweak the content on your website. If you see a keyword that occasionally appears on the list, that could be a good indicator to start paying a bit more attention to that word.
  4. Use page views to determine which pages of your website are the most or least popular. Why are the least popular pages not visited often? Is it because they are hard to find or are they not relevant to your site?
  5. Track a few basic stats monthly such as visits, pageviews, and pageviews per visit for the entire website. This will give an indication how your site is performing overtime and may show seasonal trends which where unexpected.

These are just a few tips and there are many other things to look at with your web analytics software including geographic information, network information, and much more. However, sticking with the basics can help improve your site traffic with even the smallest of changes.

 

Copyright Date in PHP

Posted: December 29th, 2007
 

I came across a site where, every year, the copyright date in the footer had to be manually updated on every page! With PHP, the following snippet of code can be used so that the date automatically gets updated each year:

Copyright <? echo date(“Y”); ?>

Voila. PHP takes the year from the server, so as long as your host’s server has the correct date, you’ll never have to update the copyright date again.