Re: [postgis-users] Need help constructing a query

2012-07-20 Thread Tom van Tilburg
Pedro, try this. No guarantee that it works on 8.3 though. If you want this data live, make sure to use views instead of tables and probably create a valid identifier for showing it from a mapserver. I see one caveat by the way: if your boat passes the bouy but turns outside your buffer and th

Re: [postgis-users] Need help constructing a query

2012-07-20 Thread Pedro Doria Meunier
I'm going to be extra-cheeky here ... :D Must be getting old as I can't wrap my head around the 8.3 construct of the query below.. :S This, as you might imagine, is for a regatta and I need to count the laps made around a single buoy for each boat. This info is going to be overlayed on Google Eart

Re: [postgis-users] Need help constructing a query

2012-07-20 Thread Tom van Tilburg
Just write the 'withs' as seperate queries that create a table or make them subqueries. Rest is for you to figure out ;-) P.S. I'd recommend (asking for) upgrading your postgres installation, 8.3 is getting old. On 20-7-2012 10:59, Pedro Doria Meunier wrote: Elegant :) Turns out I'm stu

Re: [postgis-users] Need help constructing a query

2012-07-20 Thread Pedro Doria Meunier
Elegant :) Turns out I'm stuck with an old server running PG 8.3 and can't use WITH clause :D Thanks Tom! Pedro Doria Meunier Telf. +351 291 933 006 GSM +351 915 818 823 Skype: pdoriam On 07/20/2012 09:03 AM, Tom van Tilburg wrote: > Hmm, I would still think that, as long as you have a single l

Re: [postgis-users] Need help constructing a query

2012-07-20 Thread Tom van Tilburg
Hmm, I would still think that, as long as you have a single line per-boat, this would solve your problem. Because you can find out how often this single line crosses the bouy area. The combination of ST_Intersection and ST_Dump would do that for you. Try something like: WIT

Re: [postgis-users] Need help constructing a query

2012-07-20 Thread Pedro Doria Meunier
On 07/20/2012 07:38 AM, Tom van Tilburg wrote: > Hi Pedro, > > You might try to create lines from the boat tracks (see examples in > manual for ST_MakeLine) and circles (st_buffer) from the proximity > areas around the buoy. > Now do a ST_Intersection(boatline, bouycircle). The result should be a

Re: [postgis-users] Need help constructing a query

2012-07-20 Thread pcreso
You have not just a spatial dataset but a temporal one as well. You need to define how near the buoy you consider is going past it (a "pass") You could wrap an SQL around this, but if you were to use a script to carry out the query, the logic would be something like: 1. get the minimum time for

Re: [postgis-users] Need help constructing a query

2012-07-19 Thread Tom van Tilburg
Hi Pedro, You might try to create lines from the boat tracks (see examples in manual for ST_MakeLine) and circles (st_buffer) from the proximity areas around the buoy. Now do a ST_Intersection(boatline, bouycircle). The result should be a set of lines within the bouycircle. Every line stands