spatial

Calculate the Hilbert value of a point for use in a Hilbert R-Tree?

I have an application where a Hilbert R-Tree (wikipedia) (citeseer) would seem to be an appropriate data structure. Specifically, it requires reasonably fast spatial queries over a data set that will experience a lot of updates. However, as far as I can see, none of the descriptions of the algorithms for this data structure even mentio...

Storing objects for locating by x,y coordinates

I'm trying to determine a fast way of storing a set of objects, each of which have an x and y coordinate value, such that I can quickly retrieve all objects within a certain rectangle or circle. For small sets of objects (~100) the naive approach of simply storing them in a list, and iterating through it, is relatively quick. However, f...

Close point of approch detection

I have a large set of 3rd order polynomials in 3D. in matrix form [Pn](t) = [1,t,t^2,t^4]*[An] // [Pn] and [An] are matrices each function has a weight Wn. I want to, for some n, m, T and t0 find the first t where t>t0 such that Wn*Wm / |[Pn](t)-[Pm](t)|^2 > T aside from a the O(n^2) "try everything" approach I'm not even sure w...

How to persist a calculated GEOMETRY or GEOGRAPHY column

I'm trying to create a table under SQL Server 2008 containing a GEOMETRY column and a calculated variation thereof. Considering the following table where the calculated column returns a buffered geometry: CREATE TABLE [dbo].[Test] ( [Geometry] GEOMETRY NOT NULL, [Buffer] FLOAT NOT NULL, [BufferedGeometry] AS ([Geometry]....

Spatial Data Structures for moving objects?

I was wondering what is the best data structure to deal with a lot of moving objects(spheres, triangles, boxes, points, etc)? I'm trying to answer two questions, Nearest Neighbor and Collsion detection. I do realize that traditionally, data structures like R trees are used for nearest neighbor queries and Oct/Kd/BSP are used for collis...

Fastest way of finding object in collection with coordinates near point

I have collection of objects. Each object represents a coordinate range (ie, a block). What I want is to find the object near another coordinate in a given direction. Is there a way to do this without traversing the whole collection all the time? ...

Store 2D points for quick retrieval of those inside a rectangle

I have a large number of 2D points and I want to quickly get those that lie in a certain rectangle. Let's say a '.' is any point and 'X' is a point I want to find inside a rectangle which has 'T' as TopLeft and 'B' as BottomRight points: . . . . . . . T-----+ . . | X X | . . +-----B . . . . . . . I have tried a std::set with a sort fu...

Clustering Lat/Longs in a Database

Hi folks, I'm trying to see if anyone knows how to cluster some Lat/Long results, using a database, to reduce the number of results sent over the wire to the application. There are a number of resources about how to cluster, either on the client side OR in the server (application) side .. but not in the database side :( This is a simi...

Is it possible to export spatial data from Sql Server 2008 in gml2 format?

Sql Server 2008 supports spatial data with new geometry and geography UDT's. They both support AsGml() method to serialize data in gml format. However they serialize data into GML3 format. Is there any way to tell it to serialize data into GML2 format? ...

NHibernate.Spatial and Sql 2008 Geography type

hi there, i'm currently working on a project where i have to deal with sql server 2008 geography types. As big parts of the projects uses NHibernate as ORM i wonder how much work it will be to use/extend NHibernate.Spatial with this type (as far as i can see Nh Spatial only supports the geometry type yet). Btw. are there any other .net ...

Broad phase collision detection - Quadtrees, BSP, etc.

Collision detection is naturally an O(n^2) problem. You have a bunch of objects and you need to check if that object is colliding with every other object. Right now that is my naive approach and while it isn't a problem for a limited number of objects I'm now approaching the point that it is a bottleneck (after profiling my code). H...

With SQL 2008 spatial functions, how can I construct a LINESTRING representing the line between two (or more) POINT instances?

Define a couple of points as follows: declare @p1 geography, @p2 geography set @p1 = 'POINT(1 2)' set @p2 = 'POINT(6 8)' Now I'd like to obtain the shortest line between these two points. What function can I use to get this line? (i.e., it should output a LINESTRING(1 2, 6 8) or LINESTRING(6 8, 1 2)) I know I could do this by formatt...

How can I do this Spatial Query in Sql 2008?

Hi folks, i'm trying to do a spatial query in sql 2008 -> for a given list of POI's (point of interest, long/lat GEOGRAPHY data), which postcodes do they exist in (multipolygon GEOGRAPHY data). So this is the query i tried, but it's syntactically incorrect:- SELECT PostCodeId, ShapeFile FROM Postcodes a WHERE a.ShapeFile.STIntersects(...

MS SQL Server 2008 Spatial Indexing - Does it work?

Has anyone tried using it and can say if it's well implemented? -- Assaf (who spent the last few weeks getting increasingly frustrated with MySQL's deficient implementation of OpenGIS functions and is now considering switching to MSSQL) ...

Pre RTree step: Divide a set of points into rectangular regions each containing one point...

Hi, given my current position (lat,long) I want to quickly find the nearest neighbor in a points of interest problem. Thus I intend to use an R-Tree database, which allows for quick lookup. However, first the database must be populated - of course. Therefore, I need to determine the rectangular regions that covers the area, where each re...

What's the best way to store co-ordinates (longitude/latitude, from Google Maps) in SQL Server?

I'm designing a table in SQL Server 2008 that will store a list of users and a Google Maps co-ordinate (longitude & latitude). Will I need two fields, or can it be done with 1? What's the best (or most common) data-type to use for storing this kind of data? ...

Adding a LineString to a MultiLineString

With SQLServer 2008 I'm trying to transform two LineStrings to a multiple LineStrings (preferably a MultiLineString), by splitting them up in part based on each other. L1 |---------------| L2 |----| = |----|----|-----| Thinking in generic terms I can get the centerpart by using L1.STIntersection(L2). The two other parts I can ...

Any good spatial database tutorials out there?

I was looking to explore the spatial capabilities of PostGIS or SQL Server 2008. Maybe Oracle as well. I was wondering if there are any good tutorials out there exploring the spatial capabilities of these database in particular or of this type of capability in general. Does anyone know of any? Book recommendations would work as well. ...

Cannot access property spatialindextype

I'm using SQL Server 2008, and I go to try and script one of my tables, I get the error "Cannot access property SpatialIndexType This is not available in Sql Server 2005". Trouble is, I'm using 2008. I have no idea what this means. I just want to script the table so I can create it in a dev database without having to add all the column...

Navigating with arrow keys

What are some generally accepted practices for navigating between irregularly placed and sized elements in a canvas (such as controls on a form) using the arrow keys? For example, if the currently focused element is a tall element (A) whose height encompasses three shorter elements to the right of it (B, C and D): ####### ####### # ...