JavaScript
  Home arrow JavaScript arrow Page 3 - Working with Yahoo! Maps
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
VeriSign Whitepapers 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

Working with Yahoo! Maps
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2008-04-01

    Table of Contents:
  • Working with Yahoo! Maps
  • Building a simple regional map
  • Building a primitive hybrid Yahoo! Map
  • Building a basic satellite Yahoo! Map

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Working with Yahoo! Maps - Building a primitive hybrid Yahoo! Map


    (Page 3 of 4 )

    As explained in the section that you just read, the “setMapType()” method that belongs to the “Ymap” class allows you to specify what type of map should be displayed on the browser. Possible values that will be accepted by the method in question are: YAHOO_MAP_REG, YAHOO_MAP_HYB, and finally YAHOO_MAP_SAT.

    Obviously, the first value indicates that a regional map should be built, while the other two specify that hybrid and satellite maps should be shown, respectively. As you can see, these parameters are quite easy to grasp and I believe that you shouldn’t have major problems understanding how they work.

    All right, now that you have learned how to build a basic regional Yahoo! Map, it’s time to build a different one. So below I set up another hands-on example that shows how to create a hybrid map.

    Please take a close look at the following code sample:


    <!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! Hybrid Map</title>

    <script type="text/javascript" src="http://api.maps.yahoo.com/ajaxymap?v=3.7&appid=Your-
    AP-ID"></script>

    <style type="text/css">

    body{

    padding: 0;

    margin: 0;

    background: #fff;

    }

    h1{

    font: bold 16pt Arial, Helvetica, sans-serif;

    color: #000;

    text-align: center;

    }

    #mapcontainer{

    height: 400px;

    width: 500px;

    margin-left: auto;

    margin-right: auto;

    }

    </style>

    </head>

    <body>

    <h1>Example on building a YAHOO! Hybrid Map</h1>

    <div id="mapcontainer"></div>

    <script type="text/javascript">

    // Create a new map object

    var map=new YMap(document.getElementById('mapcontainer'));

    // Add type controls to the map

    map.addTypeControl();

    // Set map type to YAHOO_MAP_HYB

    map.setMapType(YAHOO_MAP_HYB);

    // Display the map centered on the selected location

    map.drawZoomAndCenter("Los Angeles",3);

    </script>

    </body>

    </html>


    In the previous example, I played a bit with the respective “setMapType()” that you saw earlier to build a hybrid Yahoo! Map. Of course, the rest of the example’s source code remained practically the same. In addition, as you may have noticed, the map in question is displayed using the city of Los Angeles as the initial geographical location. It certainly can be better visualized by the following screen shot:



    Well, if you’re anything like me, then at this stage you should feel more than happy, because you learned how to create a hybrid Yahoo! Map by using some simple structural markup in conjunction with some understandable CSS styles and basic JavaScript code.

    What’s next? So far I showed you how to build both regional and hybrid maps, so the only type that remains uncovered is the one built upon satellite images only. In the last section of this article, I’m going to explain how to create these maps with minor hassles.

    To see how this brand new Yahoo! Map will be built, click on the link that appears below and keep reading.

    More JavaScript Articles
    More By Alejandro Gervasio


       · Yahoo! brings the possibility to incorporate its Yahoo! maps to web applications...
     

    JAVASCRIPT ARTICLES

    - Using the Style Object for Zebra Tables with...
    - Binary Searching
    - An Improved Approach to Building Zebra Tables
    - Assigning Background Colors Dynamically to Z...
    - Building Zebra Tables with CSS and JavaScript
    - JavaScript: Array Objects
    - A Closer Look at Smart Markers with Yahoo! M...
    - Using Polylines and Smart Markers with Yahoo...
    - Bulleted Menu of Links
    - Creating Click Loggers and Basic Markers wit...
    - Adding Pan Controls to Yahoo! Maps
    - Adding Zoom Controls to Yahoo! Maps
    - Working with Yahoo! Maps
    - Building Image Zooming Controls with the DOM...
    - Working with Multiple Graphics for a Zoom Ap...







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway