问题描述
我正在创建一个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 (将#修改为@)