
This reference manual defines the classes and methods available with the Yahoo! Maps AJAX API. Need more help? Check out our Getting Started Guide.
| Class | Description |
|---|---|
| YLog | Captures debugging messages conveniently to logging widget |
| Class | Description |
|---|---|
| YCustomOverlay | Enables overlay of custom objects at YGeoPoint or YCoordPoint |
| YCoordPoint | Creates an x,y coordinate object |
| YEvent | Registers API events |
| YGeoPoint | Defines objects with latitude and longitude properties |
| YMap | Defines maps and offers many methods which can change the attributes of the map |
| YMarker | Defines map marker objects |
| YImage | Defines custom image object |
| YSize | Defines size objects used for height/width manipulations |
| YGeoRSS | Defines GeoRSS objects used for XML data overlay |
Captures printed debug messages, conveniently formats output.
| Parameter | Description |
|---|---|
| print(MESSAGE) | Prints given message to capturing widget |
| initPos(YCoordPoint) | Optionally initializes position of the logger |
| initSize(YSize) | Optionally initializes width and height of the logger |
YCustomOverlay provides for overlay of custom objects
| Parameter | Description |
|---|---|
| YGeoPoint or YCoordPoint | Position object of type YGeoPoint (location position) or YCoordPoint (container coordinate position) |
| HTMLobject | Customized map overlay HTML object |
YCoordPoint creates an object with x, y coordinate properties. The coordinates are in pixels with coordinate (0,0) as the upper left hand corner of the map.
| Parameter | Description |
|---|---|
| x | An integer representing the pixel position from the top, left corner of the map on the x axis. |
| y | An integer representing the pixel position from the top, left corner of the map on the y axis. |
| Property | Description |
|---|---|
| x | The pixel position from the top, left corner of the map on the x axis. |
| y | The pixel position from the top, left corner of the map on the y axis. |
Event registration is done through this class.
| Method | Description |
|---|---|
| Capture( object , event , callback ) |
Capture an event on a map or marker. Parameters:
Return value: void The event parameter should be a property of the EventsList object (e.g. EventsList.MouseUp):
YMarker specific
YGeoRSS specific
YMap/YMarker by address specific
|
Defines an object with latitude and longitude properties.
| Parameter | Description |
|---|---|
| lat | A float representing geographic latitude |
| lon | A float representing geographic longitude |
| Property | Description |
|---|---|
| Lat | latitude property |
| Lon | Longitude property |
YMap class exports a number of methods to draw, pan and interact with Yahoo! maps, including overlay of markers.
| Parameter | Description |
|---|---|
| mapContainer | The DOM id of the div element which will hold the map |
| mapType | Current data types supported by map: YAHOO_MAP_SAT, YAHOO_MAP_REG, YAHOO_MAP_HYB |
| mapSize | A YSize object controls maps container dimensions |
| Method | Description |
|---|---|
| setMapType(mapType) | Sets current map type Parameters:
Return value: void |
| getCurrentMapType() |
Return value: current mapType constant |
| getMapTypes() |
Return value: array of mapTypes [YAHOO_MAP_REG, YAHOO_MAP_SAT, YAHOO_MAP_HYB] |
| addTypeControl() | Adds an overlay with three controls by default Parameters:
Return value: void |
| addMarker(YGeoPoint, id) | Adds a marker to the map at the specified location. Parameters:
Return value: void |
| addOverlay(Overlay) | Adds an overlay object to the map, supports adding object of YGeoPoint (markers, smart window for example) and YCoordPoint (controls for example) types Parameters:
Return value: void |
| addPanControl | Adds a pan control widget to the map |
| addZoomLong | Adds a zoom slider control widget to the map |
| addZoomShort | Adds a +/- zoom button control widget to the map |
| convertLatLonXY(YGeoPoint) | Converts a lat/lon pair to an x/y coordinate point Parameters:
Return value: YCoordPoint |
| convertXYLatLon(YCoordPoint) | Converts an x/y coordinate point to a lat/lon pair. Parameters:
Return value: YGeoPoint |
| disableDragMap | Disable draggable maps |
| drawZoomAndCenter( LocationType, ZoomLevel ) |
The main draw method . Parameters:
Return value: void |
| enableDragMap | Enables draggable maps |
| getBoundsLatLon | Returns the top left and bottom right lat/lon points of the map Return value: an object with the properties LatMax, LonMax, LatMin, LonMin. |
| getCenterLatLon | Returns the lat/lon pair corresponding to the center of the map. Return value: YGeoPoint object |
| getContainerSize | Returns port size object {width, height} |
| getEventsList | Returns the current list of supported events stored in the EventsList object (see YEvent class) |
| getInnerRadius | Returns an integer -- the number of pixels that comprise the shortest distance from the center of the map to the edge. |
| getMarkerIDs | Returns an array which has the ids of all markers currently in the map |
| getOuterRadius | Returns an integer -- the number of pixels that comprise the longest distance from the center of the map to the edge. |
| getUnitsPerPixel(ZoomLevel) | Returns the granularity of distance represented by each pixel on the map at the specified zoom level Parameters:
Return value: An object with the following properties: miles, kilometers |
| getZoomLevel() | Sets current map type Parameters:
Return value: default 1-17 current zoom level, best zoom level if array of YGeoPoints |
| getZoomValidLevels | Return array of valid zoom integers |
| isDragMapEnabled | Returns boolean value determining whether map is draggable |
| panToLatLon(YGeoPoint) | Pans map to the given lat/lon Parameters:
Return value: void |
| panToXY(YCoordPoint) | Pans map to the given x/y coordinates Parameters:
Return value: void |
| removeMarker(id) | Removes marker specified by id Parameters:
Return value: void |
| removeMarkersAll | Removes all markers from the map |
| removeOverlay(overlayObject) | Removes the specified overlayObject object from the map Parameters:
Return value: void |
| removePanControl | Removes the pan control widget from the map |
| removeZoomControl | Removes the zoom control widget from the map |
| resizeTo(YSize) | Given YSize object, resize map to new dimensions Parameters:
Return value: void |
| setZoomLevel(zlevel) | Set new zoom level and redraw map at that zoom level |
| setZoomRange(minZoomLevel,maxZoomLevel) | Constrain zoom selection range Parameters:
Return value: void |
| showSmartWindow( YGeoPoint, InfoValue ) |
Opens a SmartWindow at the location defined by YGeoPoint. The SmartWindow will display InfoValue. The InfoValue parameter can be an existing DOM object with nodeValue text. Parameters:
|
The YMarker class instantiates map marker objects.
| Parameter | Description |
|---|---|
| YGeoPoint | An object that holds a latitude/longitude pair |
| YImage (optional) | An object that holds custom marker definitions |
| ID (optional) | A string which identifies the marker as a DOM object (its CSS id attribute). The string should be comprised of digits (0-9) and/or lowercase letters (a-z). An ID will be automatically generated if this parameter is not provided. It's recommended to let API handle ID assignment. |
| Method | Description |
|---|---|
| addAutoExpand(InfoValue) | Add AutoExpand window, use alone or with SmartWindow, automatically opens on mouseover and closes on mouseout events Parameters:
|
| openAutoExpand() | open AutoExpand window if defined |
| closeAutoExpand() | close AutoExpand window if defined |
| hide() | hides marker from the map |
| unhide() | unhides marker on the map |
| ishidden() | Check if current marker is hidden Return value: boolean |
| setSmartWindowColor | set color of the SmartWindow border Parameters:
|
| addLabel | Adds a label to the marker. Parameters:
|
| reLabel | change label on the marker Parameters:
|
| closeSmartWindow | Close the SmartWindow for the marker |
| openSmartWindow( InfoValue ) |
Opens a smart window for the marker. The SmartWindow will display InfoValue. The InfoValue parameter can be an existing DOM object with nodeValue text. Parameters:
|
The YImage class instantiates image objects.
| Properties | Description |
|---|---|
| srcImg | Image URL location |
| sizeImg | YSize(width,height) object describing size of the image |
| offsetSmartWindow | Position of SmartWindow is present relative to left,top coordinates of the marker image |
A size object with width and height properties. This object is used as a parameter for calls such as the YMap constructor and the YMap resizeTo method.
| Parameter | Description |
|---|---|
| width | The integer pixel width of the map |
| height | The integer pixel height of the map |
| Property | Description |
|---|---|
| Width | The integer pixel width of the map |
| Height | The integer pixel height of the map |
A YGeoRSS object enables you to overlay your own data given valid GeoRSS XML file.
| Parameter | Description |
|---|---|
| URL | URL of valid GeoRSS file. Domain of this file should equal that including Maps API. More information on supported GeoRSS type |
| Property | Description |
|---|---|
| onStartGeoRSS | Register a callback before automatic overlay starts. For example: YEvent.Capture(map,EventsList.onStartGeoRSS, myCallback); |
| onEndGeoRSS | Register a callback after GeoRSS overlay has completed. For example: YEvent.Capture(map,EventsList.onEndGeoRSS, myCallback); |
The Yahoo! Maps AJAX API is limited to 50,000 queries per IP per day and to non-commercial use. See information on rate limiting.
You may use location data derived from GPS or other location sensing devices in connection with the Yahoo! Maps APIs, provided that such location data is not based on real-time (i.e., less than 6 hours) GPS or any other real-time location sensing device, the GPS or location sensing device that derives the location data cannot automatically (i.e. without human intervention) provide the end user's location, and any such location data must be uploaded by an end-user (and not you) to the Yahoo! Maps APIs.
Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Copyright Policy - Job Openings