【问题标题】:How to create array of coordinates?如何创建坐标数组?
【发布时间】:2017-04-17 14:14:44
【问题描述】:

我正在 nodejs 后端进行地理位置搜索。而mongodb是数据库。为了做到这一点,我从前端获取值。我正在使用 map getbound 来获取视口数据。下面是一些包含纬度和经度的变量。

  var topLeftLong = parseFloat(req.body.topLeftLong);
  var topLeftLat = parseFloat(req.body.topLeftLat);

  var topRightLong = parseFloat(req.body.topRightLong);
  var topRightLat = parseFloat(req.body.topRightLat);

  var bottomRightLong = parseFloat(req.body.bottomRightLong);
  var bottomRightLat = parseFloat(req.body.bottomRightLat);

  var bottomLeftLong = parseFloat(req.body.bottomLeftLong);
  var bottomLeftLat = parseFloat(req.body.bottomLeftLat);

虽然我正在获取这些数据,但我想将纬度和经度放在一个数组中。但是每当我尝试将数据推送到数组中时,都会出现以下错误。

【问题讨论】:

    标签: arrays node.js mongodb express coordinates


    【解决方案1】:

    似乎应该归咎于错误的数据类型。如果您应用演员表,则在您的代码中,例如(int)string-var,那么它可能是由于那个错误。数据类型很重要。不匹配的数据类型会导致错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-10-27
      • 2013-08-28
      • 2015-05-28
      • 1970-01-01
      • 1970-01-01
      • 2022-01-12
      • 1970-01-01
      相关资源
      最近更新 更多