Tag: 地理

node.js中的地理编码工具

我正在寻找node.js库来处理地理空间数据。 我在数据库中有大量的地理标记数据。 所需的function包括: GeoCoding和反向地理编码 find附近的项目 在地质界限内查找项目 就像一个相当于RoR中的GeoCoder gem的节点一样。

节点,js – Mongoose – 无法保存地理多边形 – CastError:强制转换为编号失败

我正在尝试将地理点和地理多边形保存到Mongo。 我的testing通过点,但失败的多边形: CastError:在path“坐标”处投射数值失败,值为“0,0,3,0,3,3,0,3,0,0” 我的模式如下: var GeoSchema = new Schema({ name: String , coordinates: [Number] }); GeoSchema.index({ coordinates: '2dsphere' }); 我成功保存的testing点对象: geoPoint = new Geo({ coordinates: [2,2], type: 'Point' }); 我的testing多边形对象不能保存: geoPolygon = new Geo({ type: 'Polygon', coordinates: [[ [0,0], [3,0], [3,3], [0,3], [0,0] ]] }); 我曾尝试更改为“坐标”的typesdef到一个对象和一个数组,但然后都无法保存。 任何人都可以build议吗? *更新* 我现在可以使用以下方法传递testing: 模式: var GeoSchema = new Schema({ […]

如何用2d geo索引正确定义Mongoose模式中的数组对象

我目前在为下面的文档创build模式时遇到问题。 来自服务器的响应总是以“对象”的forms返回“trk”字段值。 不知何故,我不知道这应该如何工作,因为我至less尝试了所有对我有意义的方法;-) 如果这有帮助,我的Mongoose版本是3.6.20和MongoDB 2.4.7而在我忘记之前,它也将很好设置为索引(2d) 原始数据: { "_id": ObjectId("51ec4ac3eb7f7c701b000000"), "gpx": { "metadata": { "desc": "Nürburgring VLN-Variante", "country": "de", "isActive": true }, "trk": [ { "lat": 50.3299594, "lng": 6.9393006 }, { "lat": 50.3295046, "lng": 6.9390688 }, { "lat": 50.3293714, "lng": 6.9389939 }, { "lat": 50.3293284, "lng": 6.9389634 }] } } mongoose纲要: var TrackSchema = Schema({ _id: […]