[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.2

How do I identify temporal and spatial relationships via SQL query

Asked by passionlessDrone in SQL Query Syntax, SQL Server 2005, GIS & GPS Programming

Tags: SQL / SQL Server / View / latitude / longitude / GIS / GPS

Hello friends -

I'm looking at data returned by our GPS provider that tells me where a vehicle reported its location.  The GPS units report about every 15 seconds or so.  This data is not spatially aware at this stage, but I do have lat/long and a timestamp.  That is, for example, I might have a lat/long at 7:30:00 / 7:30:15 / 7:30:30 - .... 4:00:00 - if a particular worker were to start driving at 7:30:00 and stopped working at 4:00:00.  

We've worked out a component to take this information, make it spatially aware, and pop it into GIS as a point, and map it out overlayed on top of our work order data and road data; essentially this is where the user drove over the day in relationship to the work they reported doing.  Great.  Now, to be really tricky, what we would like to do is create points where the vehicle reported it was stopped for certain timeframes; i.e., make a point with a different flavored icon if a vehcile stops for 10 minutes, 20 minutes, or more than thirty minutes.  At this point, you can see where they drove, where they worked, and where they stopped and for how long; which is often times quite a bit different from where they were supposedly working.  

Programmatically, it is difficult to engage in the environment that might allow for us to create points on the fly to allow for this, which is unfortunate because I can see how to do this iteratively with relative ease.  

It would be much easier for a variety of reasons to create a view of our route data that allows us to grab a lat / long / starting + ending timestamp that would represent time stopped.  In other words, if I went to lunch from 11:30 - 12:55, I would need some sql that would evaluate the route data such that it understood, this vehicle stopped reporting a change in lat/long at 11:30 and started reporting a change in lat / long at 12:55, and the lat / long values where the vehicle stopped were 32.991923 / -84.91293912 [or whatever].

My source rows might look like this:

Key     Truck #      lat            long            timestamp
101     abcd          32.1111   -84.9999    06/22/2009 11:29:45
.....   [other truck data ]
199     abcd          32.1111   -84.9999    06/22/2009  12:55:00

Ideally I could write a query that would return

Truck #       Lat            Long         Start Time                      End Time
abcd           32.1111    -84.9999   06/22/2009 11:29.45    06/22/2009    12:55:00

To make things more complicated, the fact that we might sometimes get slightly different lat / longs as a result of our timeframe, I may not be able to count on lat / longs being exactly the same between stop time report stops.  In other words, I may have data that looks like this:

Key     Truck #      lat            long            timestamp
101     abcd          32.1112   -84.9997    06/22/2009 11:29:45
.....      
199     abcd          32.1113   -84.9998    06/22/2009  12:55:00

This could happen if the device reported a location, the user drove a bit more, then cut the engine before the next reporting cycle.  This would tend to give me problems in terms of grouping on lat/longs up and above the problems I was already having.

Finally, I need to batch this up, and group by truck; i.e., I can't say, just show me the values for truck abcd on date 6/22/2009 at run time, but rather, show me all of the stop times you've got past timestamp x.   And it would be really nice if could calculate the number of minutes the vehicle was stopped.  

I am willing to award 500 points and 50000000 cool points to someone who can help.

Thanks

brian
[+][-]06/23/09 06:52 AM, ID: 24691837Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/23/09 06:57 AM, ID: 24691898Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/14/09 06:48 AM, ID: 24849422Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: SQL Query Syntax, SQL Server 2005, GIS & GPS Programming
Tags: SQL / SQL Server / View / latitude / longitude / GIS / GPS
Sign Up Now!
Solution Provided By: passionlessDrone
Participating Experts: 1
Solution Grade: A
 
[+][-]07/19/09 01:31 AM, ID: 24888670Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625