0

我有 lat lng - 48.980861、16.523444。如何从 latLng whit API (JSON) 搜索一张图片?

网址: http: //www.panoramio.com/map/#lt=48.980842&ln=16.523444&z=-3&k=2&a=1&tab=1&pl=all

API: http ://www.panoramio.com/map/get_panoramas.php?set=full&from=0&to=20&maxx=48.980861&maxy=16.523444&size=medium&mapfilter=true

网址!=API 谢谢

4

1 回答 1

0
public class MapLocation
{
    public double lat { get; set; }
    public double lon { get; set; }
    public int panoramio_zoom { get; set; }
}

public class Photo
{
    public int height { get; set; }
    public double latitude { get; set; }
    public double longitude { get; set; }
    public int owner_id { get; set; }
    public string owner_name { get; set; }
    public string owner_url { get; set; }
    public string photo_file_url { get; set; }
    public int photo_id { get; set; }
    public string photo_title { get; set; }
    public string photo_url { get; set; }
    public string upload_date { get; set; }
    public int width { get; set; }
    public string place_id { get; set; }
}

public class RootObject
{
    public int count { get; set; }
    public bool has_more { get; set; }
    public MapLocation map_location { get; set; }
    public List<Photo> photos { get; set; }
}

var dataContractJsonSerializer = new DataContractJsonSerializer(typeof(RootObject));
RootObject readObject = (RootObject)dataContractJsonSerializer.ReadObject(memoryStream);

foreach (var item in readObject.photos)
{
    //item.photo_file_url
    //item.photo_id
    //item.photo_title
    //item.photo_url
    //item.upload_date

    // and etc.
}

阅读这篇文章解析 JSON

于 2014-01-10T11:16:57.187 回答