Json Panoramio-搜索一张图片API
我有lat lng-48.980861,16.523444。 如何从latLng whit API(JSON)中搜索一张图片 网址: API: 网址=美国石油学会 谢谢Json Panoramio-搜索一张图片API,json,api,search,panoramio,Json,Api,Search,Panoramio,我有lat lng-48.980861,16.523444。 如何从latLng whit API(JSON)中搜索一张图片 网址: API: 网址=美国石油学会 谢谢公共类MapLocation { 公共双lat{get;set;} 公共双lon{get;set;} 公共int全景{get;set;} } 公开课照片 { 公共整数高度{get;set;} 公共双纬度{get;set;} 公共双经度{get;set;} public int owner_id{get;set;} 公共字符串所
公共类MapLocation
{
公共双lat{get;set;}
公共双lon{get;set;}
公共int全景{get;set;}
}
公开课照片
{
公共整数高度{get;set;}
公共双纬度{get;set;}
公共双经度{get;set;}
public int owner_id{get;set;}
公共字符串所有者\u名称{get;set;}
公共字符串所有者\u url{get;set;}
公共字符串照片文件url{get;set;}
public int photo_id{get;set;}
公共字符串photo_title{get;set;}
公共字符串photo_url{get;set;}
公共字符串上载\u日期{get;set;}
公共整数宽度{get;set;}
公共字符串place_id{get;set;}
}
公共类根对象
{
公共整数计数{get;set;}
公共布尔还有{get;set;}
公共映射位置映射_位置{get;set;}
公开列表照片{get;set;}
}
var dataContractJsonSerializer=新的dataContractJsonSerializer(typeof(RootObject));
RootObject readObject=(RootObject)dataContractJsonSerializer.readObject(memoryStream);
foreach(readObject.photos中的变量项)
{
//item.photo\u文件\u url
//item.photo\u id
//item.photo\u标题
//item.photo\u url
//item.upload\u日期
//等等。
}
阅读这篇文章
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.
}