Using Polylines and Smart Markers with Yahoo! Maps
Welcome to the fifth part of the series “Working with Yahoo! Maps.” This series teaches you how to implement the most useful features that come packaged with the Yahoo! Maps Ajax framework. It will permit you to include powerful, highly interactive maps into your own website by using a combination of basic structural markup and a few lines of JavaScript code.
Using Polylines and Smart Markers with Yahoo! Maps - Review: adding basic markers to an existing map (Page 2 of 4 )
Of course, I know that you're so curious about learning how to draw some polylines on a given Yahoo! Map that you can't wait to read that particular section of the tutorial. However, as you know, small moves take us a long way, so in this case, I'm going to show you the complete process of adding a number of basic markers to a selected map, in case you didn't have the chance to read the article in which I discussed this process in detail.
Having clarified this point, pay close attention to the following hands-on example, which demonstrates how to incorporate a few basic markers into a sample Yahoo! Map:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Example on building a YAHOO! Map and adding simple markers</title>
Even though the previous example is actually very easy to follow, let me briefly explain what it does. Basically, in this particular case, I used the click logger that you saw in the preceding article of the series to display different basic markers on a satellite Yahoo! map as the map in question is being clicked on.
As you can see, markers are added dynamically via the callback "displayMarker()" JavaScript function, which is invoked by the pertinent "YEvent.Capture()" method, which comes bundled with the Yahoo UI library. The most relevant point to stress here is that those markers are actually included into the map by using the "addMarker()" method, something that should be quite easy to grasp.
Well, at this point you've hopefully recalled the foundations of how to incorporate a few simple markers into an existing Yahoo! Map. Thus, considering this propitious scenario, it's time to learn other useful features that come packaged with the Yahoo! Map Ajax framework.
In the section to come, I'm going to show you how to draw different polylines on a selected map by utilizing the click logger that I reviewed earlier. Click on the link below and keep reading.