GeoDjango:是否有一种开箱即用的方法来生成点簇?

发布于 2024-09-03 14:32:02 字数 432 浏览 4 评论 0原文

我正在尝试使用 GeoDjango 在 Python 中的一组点上计算集群。

问题: 给定一组点,输出一组这些点的簇。 (我可以提前指定集群数量/集群大小/距离以简化)

有一些解决方案在网络上进行聚类,所以这是一个众所周知的问题。 我认为 GeoDjango 可以开箱即用地处理这些类型的问题,但不清楚如何处理 - 我搜索了 GeoDjango 文档、Google 和其他一些地方,但找不到任何内容。

在推出自己的集群解决方案之前,我想看看是否有一种简单的方法可以使用 GEOS 或 GeoDjango 中的其他包来实现此目的。

I'm trying to compute clusters on a set of points in Python, using GeoDjango.

The problem:
Given a set of points, output a set of clusters of those points.
(i'm fine specifying # of clusters/cluster size/distance in advance to simplify)

There are a few solutions on the web to do clustering, so it's a well known problem.
I thought that GeoDjango would handle these types of problems out of the box, but it's not clear how - I've searched the GeoDjango documentation, Google, and a few other places, but couldn't find anything.

Before I roll my own clustering solution, I thought I'd ask to see if there's a straightforward way to do this using GEOS or another package within GeoDjango.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

‘画卷フ 2024-09-10 14:32:02

GeoDjango 没有任何内置的集群支持;据我所知,您将与 GeoDjango 一起使用的任何现有开源 GIS 应用程序通常不提供此操作。

一些运行 Django/GeoDjango 的站点(例如 everyblock.com)已经发布了他们的集群方法,但是 GeoDjango 中并未内置这种支持。

一般来说,这些应用程序提供的功能是基于底层数据库支持的。 GEOS,PostGIS 下的库,以及一般的“最先进的技术”(至少在非 Java 世界中),没有任何类型的集群 API 或行为。

GeoDjango does not have any built in clustering support; this operation is not typically provided by any existing Open Source GIS application that you would be using with GeoDjango that I'm aware of.

Several sites running Django/GeoDjango (like everyblock.com) have published what their method is for clustering, but this support is not built into GeoDjango.

In general, the functionality provided by these applications is based on the underlying database support. GEOS, the library underneath PostGIS, and the general 'state of the art' (at least in the non-Java world), does not have any kind of clustering API or behavior.

×纯※雪 2024-09-10 14:32:02

正如 Christopher Schmidt 提到的,GeoDjango 中似乎没有任何开箱即用的集群支持。但是,如果其他人遇到这个问题,我就是这样做的:

  • 安装了 mlpy 和 numpy
  • 使用 HCluster 分层聚类算法
  • 编写了一个包装函数,将 GEOS Point 对象转换为 mlpy 可以理解的矩阵

文档位于:
https://mlpy.fbk.eu/data/doc/clustering.html

As Christopher Schmidt mentioned, there doesn't seem to be any out of the box support for clustering in GeoDjango. However, if someone else runs into this issue, here's what I did:

  • Installed mlpy and numpy
  • Used the HCluster hierarchical clustering algorithm
  • Wrote a wrapper function to convert the GEOS Point objects into a matrix that mlpy could understand

Documentation at:
https://mlpy.fbk.eu/data/doc/clustering.html

醉城メ夜风 2024-09-10 14:32:02

如果有人偶然发现这个线程:

https://github.com/biodiv/anycluster

我开源了我的 geodjango聚类应用程序。安装后,你只需要几行 javascript 即可集群。您可以轻松更改一些设置并使用您自己的图形。我还在github上添加了一些使用示例...

If anyone stumbles upon this thread:

https://github.com/biodiv/anycluster

I open sourced my geodjango clustering app. After installing it, you just need a few lines of javascript and it clusters. You can easily change some settings and use your own graphics. I also added some usage examples on github...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文