问题标签 [geographic-distance]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
760 浏览

r - 如何在 R 中对给定固定簇大小的 lat-long 进行聚类?

我有大约 50 个位置,我想在空间上对它们进行集群,并且集群的大小是固定的。说以下几个位置。

假设我想用集群大小对它们进行聚类 ~ 3

你能帮忙吗?

0 投票
0 回答
501 浏览

c# - 在批处理模式下使用 EF 6.1 调用 DbGeography 距离函数

我在 SQL Server 2014 中使用 Entity Framework 6.1 中的 DbGeography 类型,我需要找到可能有 100,000 个实体的最近位置,如下所示一个一个地执行它很慢,是否可以使用与我类似的方法在下面,但一次全部完成?

C#:

我之所以这么说是因为在此之前,我正在使用存储过程做类似的事情。

SQL中的类似:

@CoordinateList 在哪里:

如果可能的话,我想在 C# 代码中做同样的事情,而无需触及存储过程或键入 SQL 查询文字。

并行 Foreach :

EntityFramework.dll 中出现“System.InvalidOperationException”类型的异常,但未在用户代码中处理附加信息:创建模型时无法使用上下文。如果在 OnModelCreating 方法中使用上下文,或者多个线程同时访问同一个上下文实例,则可能会引发此异常。请注意,不保证 DbContext 和相关类的实例成员是线程安全的。

0 投票
1 回答
941 浏览

sql - SQL Geometry VS decimal(8,6) Lat, Long 性能

我正在研究在给定坐标附近选择最近点的性能。

选项是使用两个decimal(8,6)纬度、长列或单列geography并使用它。

我只感兴趣哪个更快?

0 投票
1 回答
1410 浏览

android - 如何从中心点获取纬度,经度最大值和最小值

我有一个 Geopoint,它是用户的当前位置。我知道它的纬度和经度。我想在用户位置周围得到一个 50 公里的正方形周长,所以我需要知道 java 中给定点周围的最小和最大纬度以及最小和最大经度是多少。有人可以帮我解决这个问题吗?提前致谢 ?

0 投票
1 回答
353 浏览

sql - sql - 在执行查询时计算距离

所以情况是这样的:我有一张供顾客使用的桌子和一张供商店使用的桌子,每个都有自己的地址。当客户正在搜索商店时,我希望按照商店与他的地址的距离对商店进行排序。我使用谷歌地图 API 获得地址之间的距离。有任何想法吗?谢谢!* 我使用带有 asp.net 的 Microsoft SQL 服务器。

0 投票
1 回答
333 浏览

c# - 查找保存在点中的经纬度之间的距离

我正在保存Points从 Google API 获得的地点坐标。我想计算其中两个点之间的距离。我尝试为此使用 GeoCoordinate 类,但该类需要纬度和经度的度数。是否可以将点转换为度数?

我试过这个:

但这会引发以下错误:

纬度值必须在 -90 到 90 度之间

0 投票
1 回答
1789 浏览

python - 地点之间的地理距离

geopy用于计算两个位置之间的距离。

这给出了一个输出

538.390445157

但我只是想geopy计算计算是否足够接近谷歌地图。所以我在谷歌地图上查了一下,上面写着

638 英里

对于相同的位置。

如何补差价?有什么建议么?谢谢你。

0 投票
1 回答
135 浏览

geographic-distance - 使用 geolib 生成 3d 点

可以使用geographiclib将(WGS84)纬度-经度对转换为3d/笛卡尔/xyz 点吗?

如果没有,是否有另一种方法可以在不使用球面近似的情况下从一个转换到另一个?

0 投票
1 回答
624 浏览

php - Calculating distance between Geo points for large datasets

I'm building an online Symfony application, and as part of the developement process i've been tasked with sorting an amount of database records based on the distance from the logged user; said user can widen the search radius at will, up to the size of the whole world.

At any moment i have access to the GPS coordinates of the logged user, and on a database table i saved latitude and longitude of the various points of interest.

Currently, there are only 400 records in the POIs' table, but due to the amount of data i must extract whenever i access it, the query time is already slightly over a second. Adding 400 trigonometric functions to such workload will soon bring such execution time beyond acceptability.

I thus need a method that's both fast and accurate to calculate such distances;

I've read multiple articles suggesting the Haversine formula, but i found that to be too slow for my needs and even an extensive article like this couldn't be of any help;

Considering that i could soon reach thousands of POIs with thousands of users logged at the same time from all over the world, how could i approach (and hopefully solve) such problem?

I'm using PHP 7.0, Symfony 3.2, and Doctrine; pdo to interface to a Mysql server, with innoDB as the database engine
My customer values accuracy over speed, but can't stand to wait more than 5 seconds
The query results are paged, thus delegating the sorting to the client is impossible
Both the database and the php server share the same (terrible) resource pool, and such pool is to be shared with other applications

On a sidenote, some of the POIs may expire after a certain date

0 投票
2 回答
673 浏览

r - 基于最短地理距离匹配数据帧

我有两个数据框,它们都包含纬度和经度坐标。第一个数据帧是对事件的观察,其中记录了位置和时间。第二个数据框是地理特征,其中记录了有关该特征的位置和信息。

我需要做的是,对于 df1 中的每一次观察,我需要找出 df2 中的哪个特征在地理上最接近。理想情况下,我会在 df1 上附加一个新列,其中每一行都是与 df2 最接近的特征。

我解决了这个问题如何为经纬度观察分配几个名称,但无法弄清楚如何将其与我的数据匹配

真正的数据帧有 1000 行,这就是为什么我不能手动执行此操作