0

I want to get street view pano_id using latitude and longitude. I met to get that from this link. http://cbk0.google.com/cbk?output=xml&ll=40.714103,-74.006206

It returns xml output and I want to get that pano_id from it. If can get A,B and C all pano_ids really appreciate that.

<panorama>
  <data_properties image_width="13312" image_height="6656" tile_width="512" tile_height="512" image_date="2012-08" pano_id="dIT1qZK8wyNVROwryyiN8g" imagery_type="1" num_zoom_levels="3" lat="40.714131" lng="-74.006188" original_lat="40.714096" original_lng="-74.006246" elevation_wgs84_m="-19.853310" best_view_direction_deg="120">
    <copyright>© 2013 Google</copyright>
    <text>Chambers Street</text>
    <street_range>66</street_range>
    <region>New York</region>
    <country>United States</country>
  </data_properties>
  <projection_properties projection_type="spherical" pano_yaw_deg="130.9" tilt_yaw_deg="-82.94" tilt_pitch_deg="1.15"/>
  <annotation_properties>
    <link yaw_deg="123.44" pano_id="l-oSyXcA8I9emj2IVGslvw" road_argb="0x80fffa73" scene="0">
      <link_text>Chambers Street</link_text>
    </link>
    <link yaw_deg="302.91" pano_id="TKBUYV2jeHoA7HTwX5bx7A" road_argb="0x80fffa73" scene="0">
      <link_text>Broadway / Chambers Street</link_text>
    </link>
  </annotation_properties>
</panorama>

enter image description here

hakre
  • 193,403
  • 52
  • 435
  • 836
Sumith Harshan
  • 6,325
  • 2
  • 36
  • 35
  • For generic problems, please use the search first and take a look into the FAQ, each Tag has one. – hakre Dec 24 '13 at 15:11

1 Answers1

1

You want to use PHP's SimpleXML.

<?php

$xml = new SimpleXMLElement(file_get_contents('http://cbk0.google.com/cbk?output=xml&ll=40.714103,-74.006206'));

foreach ($xml->data_properties as $element) {
    echo $element->attributes()->pano_id . "<br/>";
}

foreach ($xml->annotation_properties->link as $element) {
    echo $element->attributes()->pano_id . "<br/>";
}
user555
  • 1,564
  • 2
  • 15
  • 29