
The Yahoo! Maps Map Image API allows you to get a reference to a graphic of a map generated according to the parameters you specify in your request. You may specify lat/long or address in your request. This API returns a reference to an image in PNG format.
http://local.yahooapis.com/MapsService/V1/mapImage
Read the online documentation below and FAQs.
To access Yahoo! Search Web services, you will need to get an application ID. Like a browser's User-Agent string, the Application ID uniquely identifies your application and has no effect on rate limiting.
The development kit includes BSD licensed examples and libraries for various languages: Perl, Python and PHP, Java, JavaScript, and Flash.
See information on constructing REST queries
| Parameter | Value | Description |
|---|---|---|
| appid | string (required) | The application ID. See Application IDs for more information. |
| street | string | Street name. The number is optional. |
| city | string | City name. |
| state | string | The United States state. You can spell out the full state name or you can use the two-letter abbreviation. |
| zip | integer or <integer>-<integer> | The five-digit zip code, or the five-digit code plus four-digit extension. If this location contradicts the city and state specified, the zip code will be used for determining the location and the city and state will be ignored. |
| location | free text |
This free field lets users enter any of the following:
If location is specified, it will take priority over the individual fields in determining the location for the query. City, state and zip will be ignored. |
| latitude | float: -90 to 90 | The latitude of the starting location. |
| longitude | float: -180 to 180 | The longitude of the starting location. If both latitude and longitude are specified, they will take priority over all other location data. If only one of latitude or longitude is specified, both will be ignored. |
| image_type | png (default) or gif | The image format for the map. |
| image_height | integer: 10 to 2000 (default: 500) | The height of the image being generated, in pixels. |
| image_width | integer: 10 to 2000 (default: 620) | The width of the image being generated, in pixels. |
| zoom | integer: 1 to 12 (default: 6) | The zoom level for the map, from 1 (street level) to 12 (country level). If a radius is specified, this is ignored. |
| radius | float | How far (in miles) from the specified location to display on the map. The default radius varies according to the location given and the zoom level. |
| output | string: xml (default), php | The format for the output. If php is requested, the results will be returned in Serialized PHP format. |
Sample Request Url: http://local.yahooapis.com/MapsService/V1/mapImage?appid=YD-U.UxAtM_JXwbX18zcL_DpQ--&street=701+First+Avenue&city=Sunnyvale&state=CA
There is no schema for this service.
| Field | Description |
|---|---|
| Result | The URL of the image file corresponding to the requested map. Has an optional attribute:
|
The following is a sample response for a map of the Yahoo! headquarters:
<?xml version="1.0" encoding="UTF-8"?> <Result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> http://img.maps.yahoo.com/mapimage?MAPDATA=eJz6K.d6wXVM6myr2yRPfx6.kl.uMGgD3Tu4JtDQzr_33pFEsTTSaosZ9OCtsiDrsLv9t65fzjz0CJm6JO2v_ZIHLflY9gto.xWMK9ovlRJVmrBLO4FoSsh3Ipsr </Result>
This example uses PHP to make the image request, requesting serialized php output and then displays the image.
<?php
$request = 'http://local.yahooapis.com/MapsService/V1/mapImage?appid=YD-U.UxAtM_JXwbX18zcL_DpQ--&street=701+First+Avenue&city=Sunnyvale&state=CA&output=php';
$response = file_get_contents($request);
if ($response === false) {
die('Request failed');
}
$phpobj = unserialize($response);
echo '<img src="'.$phpobj["Result"].'">';
?>
The Map Image service returns the standard errors.
The Maps Image service is limited to 50,000 queries per IP address per day. See information on rate limiting.
Use of the Yahoo! Maps APIs is governed by the Yahoo! Maps APIs Terms of Use and the Yahoo! Maps Terms of Use. These Terms of Use supplant the general Yahoo! Developer Network Terms of Use. See also the Usage Policy for more information about acceptable usage of these APIs or to request additional queries.
All Yahoo! Maps Web Services are discussed on the yws-maps mailing list.
Copyright © 2008 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Copyright Policy - Job Openings