spatial-index

Spatial search for neighbor with distance limit?

自闭症网瘾萝莉.ら 提交于 2019-12-11 05:31:05
问题 In the example page it is shown how to do a neighbor search with a limit on the number of returned items. Is it possible to also specify a distance limit? I.e.: Return all items that are at most X distance from the point, and further limit the result to Y number of items." 回答1: No, if you need distance, use OVERLAPS. https://tarantool.org/doc/book/box/box_index.html#rtree-iterator 来源: https://stackoverflow.com/questions/39644902/spatial-search-for-neighbor-with-distance-limit

Can I store circle and polygon within the same spatially indexed column in postgis?

匆匆过客 提交于 2019-12-10 21:23:43
问题 According to their documentation the spatial objects can be of the following POINT(0 0) LINESTRING(0 0,1 1,1 2) POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1, 2 1, 2 2, 1 2,1 1)) MULTIPOINT(0 0,1 2) MULTILINESTRING((0 0,1 1,1 2),(2 3,3 2,5 4)) MULTIPOLYGON(((0 0,4 0,4 4,0 4,0 0),(1 1,2 1,2 2,1 2,1 1)), ((-1 -1,-1 -2,-2 -2,-2 -1,-1 -1))) GEOMETRYCOLLECTION(POINT(2 3),LINESTRING(2 3,3 4)) However , there is no circle type, where I can just store a point and its radius. And have the same feature where I

Spatial Index for Rectangles With Fast Insert

荒凉一梦 提交于 2019-12-10 17:07:25
问题 I'm looking for a data structure that provides indexing for Rectangles. I need the insert algorithm to be as fast as possible since the rectangles will be moving around the screen (think of dragging a rectangle with your mouse to a new position). I've looked into R-Trees, R+Trees, kD-Trees, Quad-Trees and B-Trees but from my understanding insert's are usually slow. I'd prefer to have inserts at sub-linear time complexity so maybe someone can prove me wrong about either of the listed data

Query processor could not produce a query plan because of the hints defined in this query. Resubmit the query and without using SET FORCEPLAN

大兔子大兔子 提交于 2019-12-10 12:47:45
问题 I am running following: DECLARE @g geography; declare @point nvarchar(50) ='' declare @i int =0, @lat decimal(8,6) =0.0, @long decimal(8,6) =0.0, @start datetime = getdate() set @lat =(select (0.9 -Rand()*1.8)*100) set @long =(select (0.9 -Rand()*1.8)*100) set @point = (select 'POINT('+CONVERT(varchar(10), @lat)+ ' ' +CONVERT(varchar(10), @long)+')') SET @g = geography::STGeomFromText(@point, 4326); SELECT TOP 1000 @lat, @long, @g.STDistance(st.[coord]) AS [DistanceFromPoint (in meters)] , st

RTree: Count points in the neighbourhoods within each point of another set of points

☆樱花仙子☆ 提交于 2019-12-07 00:40:54
问题 Why is this not returning a count of number of points in each neighbourhoods (bounding box)? import geopandas as gpd def radius(points_neighbour, points_center, new_field_name, r): """ :param points_neighbour: :param points_center: :param new_field_name: new field_name attached to points_center :param r: radius around points_center :return: """ sindex = points_neighbour.sindex pts_in_neighbour = [] for i, pt_center in points_center.iterrows(): nearest_index = list(sindex.intersection((pt

Using STCrosses() with a Spatial Index in SQL Server

醉酒当歌 提交于 2019-12-06 20:16:35
Does The Microsoft StCrosses() function for Geography data support Spatial Index? When I try to execute this function with Spatial Index I get this error message: "The query processor could not produce a query plan for a query with a spatial index hint. Reason: Spatial indexes do not support the method name supplied in the predicate. Try removing the index hints or removing SET FORCEPLAN" No. Indexing spatial data is nontrivial, and the class you are discussing can contain arbitrarily complex figures, not just simple geometric shapes. The specific way shapes and indexing is implemented can

Spatial index slowing down query

非 Y 不嫁゛ 提交于 2019-12-05 09:36:14
Background I have a table that contains POLYGONS/MULTIPOLYGONS which represent customer territories: The table contains roughly 8,000 rows Approximately 90% of the polygons are circles The remainder of the polygons represent one or more states, provinces, or other geographic regions. The raw polygon data for these shapes was imported from US census data . The table has a spatial index and a clustered index on the primary key. No changes to the default SQL Server 2008 R2 settings were made. 16 cells per object, all levels medium. Here's a simplified query that will reproduce the issue that I'm

RTree: Count points in the neighbourhoods within each point of another set of points

梦想的初衷 提交于 2019-12-05 04:23:18
Why is this not returning a count of number of points in each neighbourhoods (bounding box)? import geopandas as gpd def radius(points_neighbour, points_center, new_field_name, r): """ :param points_neighbour: :param points_center: :param new_field_name: new field_name attached to points_center :param r: radius around points_center :return: """ sindex = points_neighbour.sindex pts_in_neighbour = [] for i, pt_center in points_center.iterrows(): nearest_index = list(sindex.intersection((pt_center.LATITUDE-r, pt_center.LONGITUDE-r, pt_center.LATITUDE+r, pt_center.LONGITUDE+r))) pts_in_this

Spatial Index in MySQL - ERROR - Cannot get geometry object from data you send to the GEOMETRY field

拟墨画扇 提交于 2019-12-04 18:40:25
问题 I am new to the whole 'spatial index' thing, but it seems to be the best solution for filtering based on latitude/longitude. So I added a column to my table: So I created a geometry field: ALTER TABLE `addresses` ADD `point` POINT NOT NULL And then I tried to add an index: ALTER TABLE `addresses` ADD SPATIAL INDEX ( `point` ) But I get an error: #1416 - Cannot get geometry object from data you send to the GEOMETRY field What am I doing wrong here? 回答1: OK I found the solution: Can't create a

Error when using Spatial Index in SQL Server

那年仲夏 提交于 2019-12-04 09:14:56
I use Spatial Index and when I try to execute WHERE statement: WHERE T.GEOMETRY.STIntersects(O.GEOMETRY) = 1 AND T.GEOMETRY.STTouches(O.GEOMETRY) = 0 It works fine, but when I try to execute with OR: WHERE T.GEOMETRY.STOverlaps(O.GEOMETRY) = 1 OR T.GEOMETRY.STWithin(O.GEOMETRY) = 1 I get this error: The query processor could not produce a query plan for a query with a spatial index hint. Reason: Could not find required binary spatial method in a condition. Try removing the index hints or removing SET FORCEPLAN. Any help, what is a problem in this statement? A general solution for issues with