1
在我的維基百科API中,我得到了一個地方的座標。這個座標包含lat,lon,dim,type等。但是我也想在座標裏面添加dist,這樣我就可以從一個API獲得每個地方的距離。我現在的API是 -如何使用維基百科API在座標中包含距離?
https://en.wikipedia.org/w/api.php?format=json&action=query&redirects=1&generator=geosearch&prop=extracts|coordinates|pageimages&ggslimit=20&ggsradius=1000&ggscoord=52.5243700|13.4105300&&formatversion=2&exintro=1&explaintext=1&exlimit=20&coprop=type|dim|globe&colimit=20&piprop=thumbnail&pithumbsize=400&pilimit=20
這個API的輸出是:
"query": {
"pages": [
{
"pageid": 2511,
"ns": 0,
"title": "Alexanderplatz",
"extract": "Alexanderplatz (pronounced [ʔalɛkˈsandɐˌplats]) is a large public square and transport hub in the central Mitte district of Berlin, near the Fernsehturm. Berliners often call it simply Alex, referring to a larger neighbourhood stretching from Mollstraße in the northeast to Spandauer Straße and the Rotes Rathaus in the southwest.",
"coordinates": [
{
"lat": 52.52166748,
"lon": 13.41333294,
"primary": "",
"type": "landmark",
"dim": "1000",
"globe": "earth"
}
],
"thumbnail": {
"source": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/da/Alexanderplatz_by_the_night_-_ProtoplasmaKid.webm/400px--Alexanderplatz_by_the_night_-_ProtoplasmaKid.webm.jpg",
"width": 400,
"height": 225
}
},
...and some many JSON object similar like this...
]
}
當搜索位置的查詢DIST,我發現下面的API:
https://en.wikipedia.org/w/api.php?action=query&list=geosearch&gscoord=37.786952%7C-122.399523&gsradius=10000&gslimit=10
的輸出這個API是:
"query": {
"geosearch": [
{
"pageid": 18618509,
"ns": 0,
"title": "Wikimedia Foundation",
"lat": 37.78697,
"lon": -122.399677,
"dist": 13.7,
"primary": ""
},
... so on
]
}
現在我想知道是否有任何方法在我以前的API中包含「dist」?
非常感謝您的回答。 –