Geo-location – where are you exactly?

You can tell a search engine exactly where your enterprise and its branches are on the map. This could be advantageous when people are using local searches via Google Maps, Bing Maps etc. In some instances, you may get more (or less) credibility by being in a big city as compared to Little-Snoozing-in-the-Dell.

There is an accurate, long method that we deal with first and a shorter, probably less effective, method at the end of this chapter.

Geo-location can guide GPS-enabled shoppers to your door

Smartphones like the iPhone, Android and Windows devices all have GPS built in, allowing your map pin to appear in Google Street View and similar services.

Now that your premises are likely to be visible in Street View, here’s an SEO tip you may not have heard before: polish the brass on your front door! Only you should have done it two years ago when they took the picture.

For non-retail businesses, geo-location can improve your exposure and credibility

A business without an address may not gain the visitor’s confidence when compared with one that has. A well-known brand like Amazon can get away without people worrying about the address, but the smaller you are, the more credibility buttons you need to get pressed.

Setting the geo-location

This geo-location can be set site-wide or on a page-by-page basis and you may want to use both. Say you have a head office in Bristol and a branch in Taunton: then the website could have a Bristol location and the Taunton contact/address page have the Taunton geo-location in its header.

Use robots.txt with a geo-sitemap to set your location

All search engines automatically look for a file called robots.txt when they arrive at a website. This file contains references to what it should and shouldn’t look at and, more importantly at this stage, references to sitemaps – and this can include geo-sitemaps. Not having a robots.txt file will generate a 404 Page not found error and this is not a good thing.

robots.txt

First you need to know if your website already has a robots.txt file. Browse your website in the usual way – substituting www.replace-this.co.uk below with your website address:

http://www.replace-this.co.uk/

and then change it as follows:

http://www.replace-this.co.uk/robots.txt

If you get a result in the following form (there may be more lines than this):

User-Agent: *
Disallow:

then you have an existing robots.txt file. Otherwise, you will see a 404 Page Not Found message or be redirected.

If you have a robots.txt file, check to see if there is any reference to sitemaps in this file. There are a number of ways of referencing sitemaps (see www.sitemaps.org) so for the time being the assumption is made that you may have one or both of an XML sitemap and a geo-sitemap. In which case, your robots.txt could look something like this, though the sitemaps might be missing:

User-Agent: *
Disallow:
sitemap: http://www.replace-this.co.uk/sitemap.xml

Note that the file names may not be sitemap – the name or names are a choice that someone has made. There can be more than one sitemap but that only really applies if you have more than 50,000 pages in your website. If you are in this happy state, then this is what the robots.txt file might look like:

User-Agent: *
Disallow:
sitemap: http://www.replace-this.co.uk/sitemap1.xml
sitemap: http://www.replace-this.co.uk/sitemap2.xml

If it doesn’t look like you have a geo-sitemap and you want one, move on to creating a KML geo-location file.

KML geo-location file creation

A geo-sitemap uses a KML (Keyhole Markup Language) file that can be generated using the (free) Google Earth application.

Attaching a KML geo-location file to your website is the multi-step process listed below; explanations of each step will follow the list:

  • create a KML file and save it to your computer
  • create a new geo-sitemap file
  • create a reference to the geo-sitemap file in robots.txt;
  • upload the KML file, the geo-sitemap and robots.txt file to your website.

One of the easiest ways to create a geo-location file is with Google Earth. Go to that link and follow the instructions to download and install the correct version for your computer. Once you have it up and running, put in the appropriate address (or just postcode) in the search slot and you will be zoomed in to your area.

Google Earth pin

On the menu bar is a yellow pin, as shown above. If you click on this, a yellow pin appears on the map and you can drag it until the spiky bit rests on your premises or point of interest. Fill in the Google Earth – New Placemark box as appropriate and press OK. It will now appear in the Places list in the left pane. Right-click (ctrl-click on a Mac) on your placemark and then click on Save Place As to reveal a dialogue box that gives you a text box to save a file name and two file type options: kmz and kml.

KMZ is just the compressed version of the KML file and therefore should be favoured unless you are curious and want to look inside it with a text reader. These KML files are usually small, so it’s not a big deal if you use the uncompressed version.

Save the file with a suitable name (use location.kmz or location.kml as appropriate if your imagination fails you) in the same folder as your website or somewhere where it’s easy to upload to your website if you don’t have a local copy. You can now close Google Earth or waste a few hours zooming around the world.

Now you need to create an XML sitemap, or part of one to integrate with your existing XML sitemap. You can do this with a text file editor like Notepad, Notepad++, TextEdit. Should you elect to use a KML file, change all the references to kmz below to kml:

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:geo="http://www.google.com/geo/schemas/sitemap/1.0">
<url>
<loc>http://www.replace-this.co.uk/location.kmz</loc>
</url>
</urlset>

Save this file in the root of your website as location.xml – the file name is not important, but the file extension (xml) is.

Now that the sitemap file is complete, we need to tell the search engines where that file can be found by using robots.txt.

If you don’t have a robots.txt file already, you will need to create one with a text editor that contains the following:

User-Agent: *
Disallow:

Assuming the robots.txt file is open, add the following line:

sitemap:http://www.replace-this.co.uk/sitemap-geo.xml

What this robots.txt file is doing is allowing any search engine (also known as a User Agent) to browse all pages and also telling it that the geo-sitemap is a file called sitemap-geo.xml.

Obviously the kml/kmz and robots.txt files need to be uploaded to your website before any of this is going to work. The search engines will pick them up automatically – there is no specific need to submit them anywhere, though you can with (typically) Google's webmaster tools.

Put geo-location in a page if you think it will help the search engines

This applies if some pages need geo-data that is different from the home page, such as branch addresses.

There are two ways of putting geo-information into a web page. They are very similar in that they both use meta data in the header block.

A slight aside: broadly speaking web page code has two halves: a header and a body. Only the body is rendered on the web page, but the header contains useful information to guide browsers and search engines.

The two choices for in-page geo-location data are the ICBM (Inter-Continental Ballistic Missile) address and the geo.position address. Only one should be needed but some people put in both:

<meta name="ICBM" content="53.810382,-4.905396" />
<meta name="geo.position" content="53.810382;-4.905396" />

Notice that the ICBM address uses commas as a delimiter and the geo.position uses semi-colons.

To find the co-ordinates of a physical location, use Google Earth or similar.

The <address> tag is another way to show your location

This method may be less reliable than the longer method above because the search engine will be geo-decoding your address and you are no longer controlling the location of the map pin.

Technically this tag is used to provide contact information about a given page, so can also include a person, phone numbers and an email, though you are at the mercy of the search engine’s parser as to whether it can extract the address. Obviously you make it easier if you only put the address within the tag:

<address>Buckingham Palace
London
SW1A 1AA</address>

You can test it for efficacy if you copy the text of the resultant web page and put it into Google or Bing maps.

Frequently the style of the address ends up as italic, but you can change this with your CSS stylesheet.

Top - Contents - Next: titles, meta description and meta keywords