Home | Index

Yahoo! GeoPlanet

/place/{woeid}

Returns a resource containing the long representation of a place (unless a short representation is explicitly requested).

Supported Query Parameters

The following query parameters are supported for this collection: lang, format, callback, select, and appid. The lang parameter allows a user to choose the language used in the response. The format parameter allows a user to choose the content type of the response (XML, JSON, GeoJSON). The callback parameter allows a user to encapsulate a JSON response within a JavaScript function call. The select parameter allows a user to choose the representation of the response (short, long). The appid parameter grants authorization to use the Web service, and is required.

Representations

The short representation contains three elements: woeid, placeTypeName, and name.

The long representation additionally contains these elements: country, admin1, admin2, admin3, locality1, locality2, postal, centroid, and boundingBox.

Possible Errors

The following errors can be returned:

400 Bad Request

A valid appid parameter is required for this resource; please visit http://developer.yahoo.com/wsregapp to get an appid

Be sure to provide the appid parameter for each GeoPlanet request you make.

404 Not Found

URI has no match in the display map

Be sure that you have spelled the resource correctly.

404 Resource Does Not Exist

Could not find the resource xxx

Be sure to provide a valid woeid in requests for this resource.

406 Not Acceptable

Requested representation not available for this resource

Be sure that you have included an Accept header or format parameter with a supported value.

Examples

Example 11. Retrieving a resource for the Place Using a Given WOEID

The request:

http://where.yahooapis.com/v1/place/2507854?appid=[yourappidhere]

produces the following:

<?xml version="1.0" encoding="UTF-8"?>
<place yahoo:uri="http://where.yahooapis.com/v1/place/2507854" xml:lang="en">
  <woeid>2507854</woeid>
  <placeTypeName code="7">Town</placeTypeName>
  <name>Trenton</name>
  <country type="Country" code="US">United States</country>
  <admin1 type="State" code="NJ">New Jersey</admin1>
  <admin2 type="County" code="">Mercer</admin2>
  <admin3/>
  <locality1>Trenton</locality1>
  <locality2/>
  <postal/>
  <centroid>
    <latitude>40.21777</latitude>
    <longitude>-74.759361</longitude>
  </centroid>
  <boundingBox>
    <southWest>
      <latitude>40.183868</latitude>
      <longitude>-74.819519</longitude>
    </southWest>
    <northEast>
      <latitude>40.248291</latitude>
      <longitude>-74.728798</longitude>
    </northEast>
  </boundingBox>
</place>
          

Example 12. Retrieving a Resource for the Place with a Given WOEID, in Short Representation

The request:

http://where.yahooapis.com/v1/place/2507854?select=short&appid=[yourappidhere]

produces the following:

              
<?xml version="1.0" encoding="UTF-8"?>
<place yahoo:uri="http://where.yahooapis.com/v1/place/2507854" xml:lang="en">
  <woeid>2507854</woeid>
  <placeTypeName code="7">Town</placeTypeName>
  <name>Trenton</name>
</place>
          

Example 13. Retrieving a Resource for the Place with a Given WOEID, in JSON format

The request:

http://where.yahooapis.com/v1/place/12521721?format=json&appid=[yourappidhere]

produces the following:

{
"places":{
  "place":[
    {
      "woeid":12521721,
      "placeTypeName":"Airport",
      "placeTypeName attrs":{
        "code":14 },
      "name":"San Francisco International Airport",
      "country":"United States",
      "country attrs":{
        "type":"Country",
        "code":"US" },
      "admin1":"California",
      "admin1 attrs":{
        "type":"State",
        "code":"US-CA" },
      "admin2":"San Mateo",
      "admin2 attrs":{
        "type":"County",
        "code":"" },
      "admin3":"",
      "locality1":"Millbrae",
      "locality1 attrs":{
        "type":"Town" },
      "locality2":"",
      "postal":"94128",
      "postal attrs":{
        "type":"Zip Code" },
      "centroid":{
        "latitude":37.614712,
        "longitude":-122.391808 },
      "boundingBox":{
        "southWest":{
          "latitude":37.601822,
          "longitude":-122.408089 },
        "northEast":{
        "latitude":37.627602,
        "longitude":-122.375526 } },
      "uri":"http:\/\/where.yahooapis.com\/v1\/place\/12521721",
      "lang":"en-us" } ],
  "start":0,
  "count":1,
  "total":1 } }