Nominatim检索同一请求的不同数据

时间:2017-08-15 02:33:13

标签: node.js openstreetmap geocoding nominatim

我使用Nominatim API获取项目的某些本地街道的边界框和多边形点。

我发现的一个问题是,当我在网络浏览器上请求网址时,例如:

Rua de Santa Maria

它检索此边界框:

["32.6474594","32.64779","-16.8998967","-16.8993021"]
["32.6469257","32.6470059","-16.8981943","-16.8974107"]
["32.6478793","32.6478838","-16.9007069","-16.9005973"]
["32.6478902","32.647988","-16.9014895","-16.9007494"]

但是当我使用Node.js应用程序对请求使用相同的URL时:

var request = require('request');

var url = encodeURI("http://nominatim.openstreetmap.org/search?" + 
    "q=Rua de Santa Maria,Madeira&format=json&polygon=1&addressdetails=1");

request({url: url, json: true}, function (err, res, json){
    console.log(json);
});

它检索:

["32.6470059","32.647067","-16.8984633","-16.8981943"]
["32.6469257","32.6470059","-16.8981943","-16.8974107"]
["32.6480316","32.6480782","-16.9021559","-16.901742"]
["32.6478793","32.6478838","-16.9007069","-16.9005973"]

略有不同。检索到的多边形点也不同。任何人都知道为什么会这样?

1 个答案:

答案 0 :(得分:1)

请求很可能不一样。您的浏览器会在其请求标头中发送其他信息,例如首选语言。这些额外信息似乎会影响搜索结果。