LOGO

MapTheWay: Mapping Multiple Locations on Your Website

March 23, 2010
MapTheWay: Mapping Multiple Locations on Your Website

Leveraging Google Maps with MapTheWay for Website Integration

Since I began utilizing Google Maps, I’ve actively sought methods to integrate its functionality into various aspects of my digital life. The platform is a core component of the GPS software within my Motorola Android vehicle system. Furthermore, Google Latitude allows me to share my location with family members during travel. I consistently employ it to locate parks and historical sites while on family vacations.

Numerous authors at MakeUseOf have also highlighted the impressive features of Google Maps. For instance, Tina compiled a list of the 5 best aspects of Google Maps, and Eyal detailed the process of creating collaborative Google Maps. It’s evident that we are enthusiastic users of the service.

Today, I want to introduce you to MapTheWay, a compelling application built upon the Google API. This tool enables you to seamlessly incorporate customized Google Maps directly into your blog or website. It utilizes longitude and latitude coordinates, which are defined within an XML file and overlaid onto the map.

This represents a valuable approach to displaying multiple locations for your audience. You can either manually define a route or develop interactive software that automatically establishes waypoints by modifying the XML file through scripting. Consider the possibility of publishing blog posts that feature embedded maps, rather than simply screenshots. Your visitors can explore the maps you’ve created, and you can assign custom titles to each waypoint.

Implementing MapTheWay to Display Multiple Locations on Your Website

As we proceed through this guide, you’ll appreciate the convenience of having this feature integrated into your website. There’s no need to store or share maps externally from Google Maps; simply create a new XML file containing your waypoints, and you can instantly share a new map within minutes.

Let’s begin, and you’ll discover why this is a worthwhile tool to install for your blog or website. First, download the free basic version files to your computer. Then, use FTP to upload the “mapthewayDir” folder (along with its contents) to the root directory of your website.

For a Wordpress blog, upload the folder and all its contents, including the base files, to the same directory level as your index.php file within your theme’s folder. You are now halfway to mapping multiple locations on your blog!

If you don't currently possess a Google Maps API key for your website, visit Google and register for one, specifying the domain where you uploaded the MapTheWay directory. Once you receive your key, navigate to the mapthewayDir directory on your web server and edit the mapthewaycontext.xml file, inserting your API key.

Should you desire, you can also adjust the map language to French (fr) or Portuguese (po) instead of English. Currently, these are the only additional language options available. With this completed, MapTheWay is installed on your site, and you are prepared to begin embedding your maps!

Defining Waypoints and Displaying Your Map

The download package includes several files that you should review. Two of these are HtmlHead.txt and HtmlBody.txt. To embed a map on any of your pages, ensure that both the header and body scripts are included. The header script remains constant. If you are utilizing a Wordpress theme, it’s likely you have a header.php file where you can insert the script once, and it will be applied universally.

Now, you must create your XML file populated with your Way Points. The template to use is MyWebPage.xml, located within the mapthewayDir folder. The file format is illustrated below.

Many of the variables shown in the example file are not available in the free version. For your free setup, concentrate on defining the lat, lng, title, description, country, postcode, city, and address (all optional except for lng and lat). The "type" corresponds to the name of the marker image file; for example, "type" set to "city" references the file "marker[city].png." You can customize your own marker icons by adhering to this naming convention.

You might initially find this process somewhat complex. How are you expected to determine the latitude and longitude of your locations? Don’t worry, as the application you downloaded includes a convenient utility to identify these coordinates. Access the file through your browser by navigating to your domain. If this doesn’t function, utilize the free utility offered directly on the MapTheWay website.

Simply drag the marker along your desired route, and the utility will provide the longitude and latitude of each point. Record each waypoint as you trace your journey. Once finished, modify the MyWebPage.xml template with your new waypoints and descriptions, and save it as a new XML file within the mapthewayDir folder.

Finally, embed the map into your webpage using the code found in the HtmlBody.txt file. You will find the name of the XML file referenced three times within the code; you must edit these three instances to reflect your new XML file name.

Save the page, and your new map will now be embedded on your website!

The map integrated flawlessly on my webpage. All titles appear when a user clicks "Show Labels," and clicking on a waypoint icon displays your description text. The map presents a professional appearance and initially attempts to center on all of your waypoints upon loading.

I observed that the application didn’t interact optimally with the Wordpress file structure (it functions best when located in the root of your domain). I successfully implemented it by installing it on a newly purchased domain and creating an index.html file with the code provided in this tutorial. Therefore, if you have created your own website, embedding this application will be straightforward. Using it on a blog may require some adjustments, which are beyond the scope of this article.

Try MapTheWay on your website and share your thoughts. Are you aware of any other effective methods for embedding maps directly onto your website? Share your resources in the comments section below.

#MapTheWay#multiple locations#website map#location mapping#map integration#business locations