开发者

Efficient query to locate centroid of clusters in postgis?

开发者 https://www.devze.com 2023-03-01 05:41 出处:网络
I have a spatially-distributed collection of entities E stored and spatially indexed in a PostGis database.

I have a spatially-distributed collection of entities E stored and spatially indexed in a PostGis database.

Each entity has a number of indexed non-spatial attributes, such as TYPE, VALUE etc.

Is there a computationally-efficient query template for the following type of query:

"find the cent开发者_开发知识库roid of the circular region with radius X which includes the most E such that (some condition based on attribue values)"

eg

"find the centroid of the circular region with radius 1Km which contains the most E with TYPE == 'PIZZA-RESTAURANT'"

Thanks!


To take advantage of the spatial index you could use ST_DWithin. What is you search space? Can the centroid be anywhere in space?

0

精彩评论

暂无评论...
验证码 换一张
取 消