草庐IT

Distance

全部标签

java - Android: ListView 中的指南针+距离

我想你们都尝试过map中的“GooglePlaces”。这是您附近的POI列表。我真的很想在我的应用程序中使用GPS坐标列表来实现相同的功能,但这看起来真的很复杂。制作带有距离和小箭头的ListView非常容易,但我无法理解每次用户移动手机时如何更新此列表和箭头。现在我有一个静态ListView。我想知道是否有人成功创建了这样的ListView。非常感谢任何信息。 最佳答案 对于您要实现的目标,有几个选项。就我个人而言,我建议实现您自己的适配器(在本例中最有可能通过扩展SimpleCursorAdapter)并将对距离文本和罗盘航向

android - distance Between() 返回不准确的结果?

我使用Location类的distanceBetween()来计算两点之间的距离,如下所示:privatefloatgetDistanceInMiles(GeoPointp1,GeoPointp2){doublelat1=((double)p1.getLatitudeE6())/1e6;doublelng1=((double)p1.getLongitudeE6())/1e6;doublelat2=((double)p2.getLatitudeE6())/1e6;doublelng2=((double)p2.getLongitudeE6())/1e6;float[]dist=newflo

c++ - opencv 欧氏聚类与 findContours

我有以下图像mask:我想应用类似于cv::findContours的东西,但该算法只连接同一组中的连接点。我想以一定的公差来做到这一点,即我想在给定的半径公差范围内添加彼此靠近的像素:这类似于欧几里德距离层次聚类。这是在OpenCV中实现的吗?或者有什么快速的方法来实现这个吗?我想要的是类似这样的东西,http://www.pointclouds.org/documentation/tutorials/cluster_extraction.php应用于此mask的白色像素。谢谢。 最佳答案 您可以使用partition为此:分区将

c++ - 将结构传递给函数

我正在练习不同的方法来为结构变量赋值。但当我试过了,我得到了一些垃圾值。这是代码。#includeusingnamespacestd;structDistance{intfeet;intinches;};voidget_val(Distance);voiddisp(Distance);intmain(){Distancel,m;//Objectsget_val(l);get_val(m);disp(l);disp(m);return0;}voidget_val(Distancelength){cout>length.feet;cout>length.inches;}voiddisp(D

c++ - 如何确保迭代器不会越过 end()?

我一直在一些迭代器上使用advance,但我担心在end()上可能会出现跳跃。我想确保我的迭代器保持在边界之间,我想到了distance但它似乎没有返回我所期望的(当迭代器越过end())。您如何确保没有越级?#include#include#includeusingnamespacestd;intmain(){listmylist;for(inti=0;i::const_iteratorfirst=mylist.begin();constlist::const_iteratorlast=mylist.end();cout这是输出:Thedistanceis:10Thedistance

javascript - Mongodb geoNear 和组聚合

我一直在网上搜索与此相关的内容,但找不到。我有这个聚合Place.aggregate([{"$geoNear":{"near":{"type":"Point","coordinates":[longitude,latitude]},"spherical":true,"distanceField":"distance"}},{$group:{_id:"$_id",name:{'$first':'$name'},distance:{$first:"$distance"}}},{$project:{name:1,distance:1,}}],function(error,places){if

mongodb - 如何在 mongodb 聚合中使用 $geoNear 和 $lookup

在我的MongoDB聚合查询中,我使用$lookup将我的offers集合与outlet集合连接起来。但是,在我的“outlets”集合中,我有一个名为location的字段,我希望查询从该位置的最近到最远对结果进行排序。那么,如何将$geoNear与$lookup一起使用,我们将不胜感激?以下是我的查询:db.offers.aggregate([{$geoNear:{near:{type:"Points",coordinates:[22,77]},distanceField:"distance",maxDistance:5000,spherical:true}},{$match:{$

MongoDB/PyMongo 地理空间查询 : distance of documents from a point

我最近将我的MongoDB从2.2.1版升级到2.4.6版,并将pymongo升级到2.6.2版。升级的原因之一是新版本的MongoDB能够计算和返回文档(包括适当的坐标)与地理空间查询中心的距离asexplainedhere.到目前为止,我执行了以下查询:db.collection.find({"loc":{"$within":{"$center":[[LON,LAT],RADIUS]}}})其中LON、LAT和Radius是适当的数字。然后,我以编程方式计算返回的每个文档与中心的距离。现在我正尝试让MongoDB代我进行距离计算,因为与我的代码相比效率更高。我现在正在尝试的是:db

node.js - Mongoose $maxDistance 不精确

我将位置存储在Mongoose模型中(名称+坐标为[lng,lat])并在其上有一个2d索引。我想获得距离以公里为单位的半径内的一个点(经度、纬度)最近的位置。为此,我使用了mongoose的$near和$maxDistance参数。我面临的问题是半径似乎不精确,因此我得到了错误的结果。这是我的地理搜索代码:LocationModel.find({loc:{$near:coords,$maxDistance:max_distance}}).exec(function(err,locations){if(err)returnres.status(400).send({message:er

mongodb - 在 MongoDB map-reduce 中计算距离

我有一个带有地理索引的MongoDB集合:>db.coll.getIndexes()[//...{"v":1,"key":{"location":"2dsphere"},"ns":"test.coll","dropDups":false,"name":"location_2dsphere","background":false}]db.coll.findOne({location:{'$exists':true}},{'location':1}){"_id":ObjectId("52cd72ae2ac170aa3eaace6e"),"location":[55.4545177559,1