home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 17,738 of 19,505   
   Erland Sommarskog to James Riches   
   Re: Interpolation of position waypoints    
   24 Jan 10 23:01:58   
   
   9f1153f7   
   From: esquel@sommarskog.se   
      
   James Riches (jr2054@hotmail.com) writes:   
   > I have a database with positional information in it along the lines of   
   > waypoints of various journeys ('tracks').  I am currenetly using SQL   
   > Server 2000 so am unable to make use of the GIS types.  The columns   
   > are simply two floatst for lat and long, a timestamp and a track ID.   
   >   
   > I would like to produce a query that will linearly interpolate between   
   > the waypoints and tell me which tracks, if any were in a certain   
   > ellipse at a given time.   
   >   
   > I have constructed a very inefficient query to do this, but it takes   
   > far too long to compute.  Essentially my query does this:   
   >   
   > 1.  For each unique track, get the waypoint before and after the given   
   > time.  I think i have to use 2 self joins to achieve this.   
   >   
   > 2.  Use these fields to produce a row in a temp table for each track   
   > that gives the estimated lat and long for each track at the given time   
   >   
   > 3.  Use a complicated trigonometric expression to filter any tracks   
   > not in the ellipse   
   >   
   > Clearly this is very inefficient.   
   >   
   > My question is, what is the best way to do this type of thing (query   
   > based on an interpolated quantity, estimated position)?  I am sure   
   > that the GIS types in SQL Server 2008 will help but will they be able   
   > to do this?   
      
   In Adam Machanic's "Expert SQL Server 2005 Development" there is a   
   chapter on spatial programming, written Hugo Kornelis. This chapter   
   may give you some ideas.   
      
   The spatial stuff in SQL 2008 goes completely over my head, so I cannot   
   tell whether it can help you with this problem. But since they are   
   designed for this kind of problems, I would expect them to. I would   
   certainly encourage you to download the Evaluation version of SQL 2008   
   and play around. It seems to me that if there is a fit, you can save   
   tons of time, which very well can pay off the upgrade cost.   
      
      
   --   
   Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se   
      
   Links for SQL Server Books Online:   
   SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx   
   SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx   
   SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca