如何解决使用node.js的mapbox转发地理编码错误
我正在创建一个Web应用程序,用户可以在其中添加自己喜欢的露营地。因为我想在地图框上显示营地的位置,但我不能这样做。
//here I am passing the location
var location = req.body.location;
var newCampground = {
name: name,image: image,description: description,author: author,price: price,//storing it here
location: location,start: start,end: end,phone: phone,}
//this is a func. to store the location of camp as query
var response = geocodingClient.forwardGeocode({
query: location,limit: 1
})
.send();
req.body.campground.coordinates = response.body.features[0].geometry.coordinates;
添加新阵营时出现错误,未定义功能。坐标也是露营地模型中的一个空数组,用于存储坐标。请帮忙。 这是我的代码的链接:https://goor.me/xSfQM 上面提到的代码在routes / campgrounds.js中 并且用于地图和正向地理编码的scripts标签位于底部的views / campgrounds / show.ejs中
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。