是否有可以拨打的网络服务,并获取国家/地区列表以及每个国家/地区标志图片的链接。
答案 0 :(得分:3)
以上是Eric提到的上述API的作者 - 我愿意提供帮助。 如果您需要特定国家的旗帜,那就很简单了 请求:http://www.geognos.com/api/en/countries/flag/GR.png
为了获得所有世界国家/地区的json格式输出,您必须向http://www.geognos.com/api/en/countries/info/all.json发出HTTP GET请求 您将收到有关所有世界国家/地区的信息的回复。对于每个国家/地区,都有一个名为“SeqID”的字段。 垂直排列的所有标志的png图像提供在:http://www.geognos.com/media/flags/world-countries-flags-80X40.png和:http://www.geognos.com/media/flags /world-countries-flags-32X16.png。通过使用css sprites技术偏移垂直位置,这些图像可用于将单个标志作为图像精灵提供。可以使用“信息”请求的“IdSeq”字段和图像尺寸来计算偏移值。这是显示大量标志的最有效方式。有关使用精灵的示例,您可以查看以下页面的源代码:http://www.geognos.com/api/en/countries/info/IT.html
如果你需要任何进一步的帮助,你可以联系我。 快乐的编码: - )
答案 1 :(得分:2)
答案 2 :(得分:0)
此服务在SVG中提供标志。
https://restcountries.eu/rest/v2/all
您还可以搜索特定国家(不区分大小写)。
https://restcountries.eu/rest/v2/name/ {名称}
例如,如果您要搜索巴基斯坦,则应使用您的URL。
https://restcountries.eu/rest/v2/capital/pakistan
您将获得JSON Resonance in Return
[{"name":"Pakistan","topLevelDomain":[".pk"],"alpha2Code":"PK","alpha3Code":"PAK","callingCodes":["92"],"capital":"Islamabad","altSpellings":["PK","Pākistān","Islamic Republic of Pakistan","Islāmī Jumhūriya'eh Pākistān"],"region":"Asia","subregion":"Southern Asia","population":194125062,"latlng":[30.0,70.0],"demonym":"Pakistani","area":881912.0,"gini":30.0,"timezones":["UTC+05:00"],"borders":["AFG","CHN","IND","IRN"],"nativeName":"Pakistan","numericCode":"586","currencies":[{"code":"PKR","name":"Pakistani rupee","symbol":"₨"}],"languages":[{"iso639_1":"en","iso639_2":"eng","name":"English","nativeName":"English"},{"iso639_1":"ur","iso639_2":"urd","name":"Urdu","nativeName":"اردو"}],"translations":{"de":"Pakistan","es":"Pakistán","fr":"Pakistan","ja":"パキスタン","it":"Pakistan","br":"Paquistão","pt":"Paquistão","nl":"Pakistan","hr":"Pakistan","fa":"پاکستان"},"flag":"https://restcountries.eu/data/pak.svg","regionalBlocs":[{"acronym":"SAARC","name":"South Asian Association for Regional Cooperation","otherAcronyms":[],"otherNames":[]}],"cioc":"PAK"}]
标志图像URL在“标志”键中。