Re: [postgis-users] Creating density map
Thank you! I'll contact them. Clearly I have more reading to do. Aren On Sun, Jan 9, 2011 at 10:10 PM, Ben Madin wrote: > Aren, > > You might have more luck on the R-sig-geo list. This looks like a mix of > network analysis and point processes - > > check out pgRouting, or look for routing algorithms > check out the sp package and then spatstat, network etc. > > An approach (by no means the right or even a good one) is to think of it as > a graph or MCMC problem, and consider the relationship between the events as > probabilities that can be affected by distance. You are of course trying to > create a complex spatio-temporal model like everyone, so there is a fair bit > of literature out there. It probably pays to look at relevant articles in > your field. > > Once you have this clearer, I think you should be able to work out how to > get the data into R - but it could either be as a data frame using spatial > SQL to return attributes, or using readOGR if you need spatial objects in R > > cheers > > Ben > > > > > On 10/01/2011, at 2:50 PM, Aren Cambre wrote: > > I have three datasets: > >1. Routes >2. Event type A that occurs along the routes (points) >3. Event type B that occurs along the routes (points) > > Both event types have several attributes, including a date/timestamp, > sub-classes of each event type, and other meaningful attributes. > > I'm trying to use statistical methods to check for certain relationships > between event types A and B. They may influence each other (A may affect B > and B may affect A). I also want to see if there's a relationship between > subtypes. E.g., do events A.X or A.Y have a stronger impact on event type B? > > I'd like to make heat density maps to help interpret the data, but I have > two conceptual problems. > > *First problem is how to make the map.* The programmatically easy but slow > way is to create a greedy algorithm to traverse every route. During > traversal, create a point at each increment of distance X. An attribute of > that point may be the number of qualifying events no more than distance Y > from that point. > > I may need to limit to events along the route I am traversing. E.g., if > traversing route M looking for event type B, and I come across route N, the > heat map for route M probably should not include events of type B along > route N event if they are within Y distance from my current point. > > *Second problem is how to deal with all the permutations. *I could muck > through the simple algorithm and make spiffy point maps, and with a little > graphical wizardry, I could make the maps pretty. However, I need to do > analysis over different time periods. E.g., does the relative intensity of > week I's event type As along route M affect the occurrence of event type B > on week I+1? How about event type A.X? A.Y? Do they have different effects > over the same time period? I have between 3 and 9 years of event types A and > B... > > All the permutations (not simply combinations) of factors can really > explode the complexity of this project. > > To prevent wheel reinventing, are there already well-tread solutions to > this problem? I've done some Google searches and am not coming up with much, > so I guess I may not be using the correct lingo? > > I know that I need to incorporate R into this at some point; my objective > now is to get the data to a point where I *could* use R to analyze it. > > Aren > ___ > postgis-users mailing list > postgis-users@postgis.refractions.net > http://postgis.refractions.net/mailman/listinfo/postgis-users > > > > ___ > postgis-users mailing list > postgis-users@postgis.refractions.net > http://postgis.refractions.net/mailman/listinfo/postgis-users > > ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Difference beetween ST_ClosestPoint and ST_Intersection
Hi, thx for explanation. Regards, Andrea. Il 11/01/2011 21:53, Nicklas Avén ha scritto: Hallo Andrea The two functions is very different but behave the same way in a few specific situations. St_Intersection I guess you know how works. ST_Closestpoint is actually a distance function. It is the forst point of ST_Shortestline. The pupose of those functions is to use on geometries not intersecting at all. Look at the illustrations in the documentation: http://www.postgis.org/documentation/manual-1.5/ST_ShortestLine.html ST_Shortestline gives you the line along which ST_Distance has found the min distance between two geometries. If you use the shortestline between a lake and a road it will give you the shortest possible line between the lake and the road. And as said, ST_Closestpoint is the first point in the shortest line, so: ST_Startpoint(ST_Shortestline(geometry, geometry)) = ST_Closestpoint(geometry, geometry) St_closestpoint is there because we expected it to be the most common usecase of ST_Shortestline to just find where on my geometry is the closest point to that geometry over there. That it gives you the same answer when using it with a point intersecting with a polygon is just a way to handle that situation. The alternative is to return null. SQL Server is comming up with a corresponding function to ST_Shortestline in their next release, but they call it ShortestLineTo. They have choosen to return null in case of intersection, while postgis returns a zero-length line with the same start and end in any of the intersecting points (if many) HTH Nicklas On Tue, 2011-01-11 at 21:19 +0100, aperi2007 wrote: Il 11/01/2011 21:12, Paolo Cavallini ha scritto: Il giorno mar, 11/01/2011 alle 20.52 +0100, aperi2007 ha scritto: Hi, I need to find the intersection point between two lines, the first choice is ST_Intersection, but I notice even the ST_ClosestPoint function. \df+ st_intersection in the case of two lines, the two results converge, but if you have two polygons, you can see the difference. All the best. Hi Paolo, Of course this is a difference. ST_Intersection is surely more flexible, usable with every kind of geometry. But my question is: "why ST_ClosestPoint exist ?" The only explain I can suppose is that for linear archives it give some advantage (more speed ?) This is the question :) Andrea. ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Difference beetween ST_ClosestPoint and ST_Intersection
Hallo Andrea The two functions is very different but behave the same way in a few specific situations. St_Intersection I guess you know how works. ST_Closestpoint is actually a distance function. It is the forst point of ST_Shortestline. The pupose of those functions is to use on geometries not intersecting at all. Look at the illustrations in the documentation: http://www.postgis.org/documentation/manual-1.5/ST_ShortestLine.html ST_Shortestline gives you the line along which ST_Distance has found the min distance between two geometries. If you use the shortestline between a lake and a road it will give you the shortest possible line between the lake and the road. And as said, ST_Closestpoint is the first point in the shortest line, so: ST_Startpoint(ST_Shortestline(geometry, geometry)) = ST_Closestpoint(geometry, geometry) St_closestpoint is there because we expected it to be the most common usecase of ST_Shortestline to just find where on my geometry is the closest point to that geometry over there. That it gives you the same answer when using it with a point intersecting with a polygon is just a way to handle that situation. The alternative is to return null. SQL Server is comming up with a corresponding function to ST_Shortestline in their next release, but they call it ShortestLineTo. They have choosen to return null in case of intersection, while postgis returns a zero-length line with the same start and end in any of the intersecting points (if many) HTH Nicklas On Tue, 2011-01-11 at 21:19 +0100, aperi2007 wrote: > Il 11/01/2011 21:12, Paolo Cavallini ha scritto: > > Il giorno mar, 11/01/2011 alle 20.52 +0100, aperi2007 ha scritto: > >> Hi, > >> > >> I need to find the intersection point between two lines, > >> the first choice is ST_Intersection, but I notice even the > >> ST_ClosestPoint function. > >> \df+ st_intersection > >> in the case of two lines, the two results converge, but if you have two > >> polygons, you can see the difference. > >> All the best. > > Hi Paolo, > > Of course this is a difference. > ST_Intersection is surely more flexible, usable with every kind of geometry. > > But my question is: "why ST_ClosestPoint exist ?" > > The only explain I can suppose is that for linear archives it give some > advantage (more speed ?) > > This is the question :) > > Andrea. > > ___ > postgis-users mailing list > postgis-users@postgis.refractions.net > http://postgis.refractions.net/mailman/listinfo/postgis-users > ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Difference beetween ST_ClosestPoint and ST_Intersection
Il 11/01/2011 21:12, Paolo Cavallini ha scritto: Il giorno mar, 11/01/2011 alle 20.52 +0100, aperi2007 ha scritto: Hi, I need to find the intersection point between two lines, the first choice is ST_Intersection, but I notice even the ST_ClosestPoint function. \df+ st_intersection in the case of two lines, the two results converge, but if you have two polygons, you can see the difference. All the best. Hi Paolo, Of course this is a difference. ST_Intersection is surely more flexible, usable with every kind of geometry. But my question is: "why ST_ClosestPoint exist ?" The only explain I can suppose is that for linear archives it give some advantage (more speed ?) This is the question :) Andrea. ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Difference beetween ST_ClosestPoint and ST_Intersection
Il giorno mar, 11/01/2011 alle 20.52 +0100, aperi2007 ha scritto: > Hi, > > I need to find the intersection point between two lines, > the first choice is ST_Intersection, but I notice even the > ST_ClosestPoint function. \df+ st_intersection in the case of two lines, the two results converge, but if you have two polygons, you can see the difference. All the best. -- Paolo Cavallini: http://www.faunalia.it/pc ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
[postgis-users] Difference beetween ST_ClosestPoint and ST_Intersection
Hi, I need to find the intersection point between two lines, the first choice is ST_Intersection, but I notice even the ST_ClosestPoint function. Testing both: select ST_AsText(ST_ClosestPoint(ST_GeomFromEWKT('SRID=3003;LINESTRING(4 4, 6 6)'),ST_GeomFromEWKT('SRID=3003;LINESTRING(12 1, 3 5)'))); --> POINT(4.38461538461539 4.38461538461539) select ST_AsText(ST_Intersection(ST_GeomFromEWKT('SRID=3003;LINESTRING(4 4, 6 6)'),ST_GeomFromEWKT('SRID=3003;LINESTRING(12 1, 3 5)'))); --> POINT(4.38461538461539 4.38461538461539) They gave the same result. Supposing the geometry to check are linestrings there is some difference between the two functions ? Thx, Andrea. ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
[postgis-users] Transform WGS84 to UTM
Hi All, I'm starting to work with postgis and I have to transform geometries from WGS84 to UTM. Are there a simple way to do that using just the postgis? Thanks for all -- Rogério De Pieri (Lelo) Buscando melhorar a cada dia Áudio, Hardware & Software ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Create new lines from GPS points
I think this problem has some hidden assumptions about what is the rate of the incoming points, or more appropriately how close together the GPS points are and with mis-alignment of GPS with respect to high density road networks. If the GPS sample rate is high and the relative distance is small percentage of the road network segments then the problem is easier to solve because you can assume that any given point is likely on the same segment as the last point or just transitioned to the next segment in the network. There are still serious issue if there is a mis-alignment between the GPS data and the road segments, especially in dense road network areas. Here you might need to apply a stickiness to the segment you are one and do additional analysis and in fact defer judgment to N-1 when looking at point N. Also as your sample rate spreads out and the distance between GPS point increases then the last segment and the current segment might not even be touching so you might need to route between the adjacent GPS points. Add to this mis-alignment issues and you have a very tricky problem to solve. The above issues are particularly prevalent in CDMA cell phone tower assisted GPS systems that can have a lot of error in urban areas which also have higher density road networks, but need to be considered with any system like this. -Steve W On 1/11/2011 12:15 PM, Ralf Suhr wrote: This will work. The GPS point is never on the road geometry. ST_Line_Substring( road, ST_Line_Locate_Point(road, ST_ClosestPoint(gps_start, road)), ST_Line_Locate_Point(road, ST_ClosestPoint(gps_end, road)) ) AS highlight Gr Ralf Am Dienstag 11 Januar 2011, 18:08:29 schrieb Ralf Suhr: > Hi Martin. > > ST_Line_Substring(road, ST_Line_Locate_Point(road, gps_start), > ST_Line_Locate_Point(road, gps_end)) AS highlight > > Gr > Ralf > > Am Dienstag 11 Januar 2011, 17:46:06 schrieb Martin Fafard: > > Ralf > > > > Yes, ok for the buffer. But how to "dynamically segment" my new road > > from my original segment? > > > > Martin > > > > Ralf Suhr a écrit : > > > Hi Martin, > > > > > > you will not get a correct solution for this problem. Your road network > > > and the gps points differs always. > > > > > > A possible "solution" is building a buffer around the streets und look > > > für intersection with gps points and filter by direction road/points. > > > Grouping gps points can give you the start and end point for the road. > > > If a road is only one times driven. > > > > > > Gr > > > Ralf > > > > > > Am Dienstag 11 Januar 2011, 17:16:18 schrieb Martin Fafard: > > >> Hi > > >> > > >> I have a network of roads (topological) and I receive GPS points. I > > >> would like to create new lines who follow exactly the same path as my > > >> road from the GPS points (to "highlight" where the GPS unit was on the > > >> network). The problem is I need to segment the new line because the > > >> GPS points can stop anywhere on my roads... Any advice to do this? > > >> Thank you > > >> > > >> Martin F > > >> ___ > > >> postgis-users mailing list > > >> postgis-users@postgis.refractions.net > > >> http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Error Installation
Hi, Do you have the development files for PostgreSQL installed? Did the ./configure step show any warnings or errors? -Mike On 12 January 2011 04:13, mahadzar ayala wrote: > Hi, > I'm using Linux Suse SUSE Linux Enterprise Server 11 (ia64) > 2.6.27.45-0.1-default kernel with databases version PostgreSQL 8.3. > > I've tried to install postgis version1.5.2 but receive an error message > > postg...@myhostname:~/postgis-1.5.2> make install > make -C liblwgeom > make[1]: Entering directory `/var/lib/pgsql/postgis-1.5.2/liblwgeom' > make[1]: Nothing to be done for `all'. > make[1]: Leaving directory `/var/lib/pgsql/postgis-1.5.2/liblwgeom' > make -C postgis > make[1]: Entering directory `/var/lib/pgsql/postgis-1.5.2/postgis' > Makefile:80: /usr/local/pgsql/8.3/lib/pgxs/src/makefiles/pgxs.mk: No such > file or directory > make[1]: *** No rule to make target > `/usr/local/pgsql/8.3/lib/pgxs/src/makefiles/pgxs.mk'. Stop. > make[1]: Leaving directory `/var/lib/pgsql/postgis-1.5.2/postgis' > make: *** [postgis] Error 2 > > Please advice me.. > > > ___ > postgis-users mailing list > postgis-users@postgis.refractions.net > http://postgis.refractions.net/mailman/listinfo/postgis-users > > ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Create new lines from GPS points
This will work. The GPS point is never on the road geometry. ST_Line_Substring( road, ST_Line_Locate_Point(road, ST_ClosestPoint(gps_start, road)), ST_Line_Locate_Point(road, ST_ClosestPoint(gps_end, road)) ) AS highlight Gr Ralf Am Dienstag 11 Januar 2011, 18:08:29 schrieb Ralf Suhr: > Hi Martin. > > ST_Line_Substring(road, ST_Line_Locate_Point(road, gps_start), > ST_Line_Locate_Point(road, gps_end)) AS highlight > > Gr > Ralf > > Am Dienstag 11 Januar 2011, 17:46:06 schrieb Martin Fafard: > > Ralf > > > > Yes, ok for the buffer. But how to "dynamically segment" my new road > > from my original segment? > > > > Martin > > > > Ralf Suhr a écrit : > > > Hi Martin, > > > > > > you will not get a correct solution for this problem. Your road network > > > and the gps points differs always. > > > > > > A possible "solution" is building a buffer around the streets und look > > > für intersection with gps points and filter by direction road/points. > > > Grouping gps points can give you the start and end point for the road. > > > If a road is only one times driven. > > > > > > Gr > > > Ralf > > > > > > Am Dienstag 11 Januar 2011, 17:16:18 schrieb Martin Fafard: > > >> Hi > > >> > > >> I have a network of roads (topological) and I receive GPS points. I > > >> would like to create new lines who follow exactly the same path as my > > >> road from the GPS points (to "highlight" where the GPS unit was on the > > >> network). The problem is I need to segment the new line because the > > >> GPS points can stop anywhere on my roads... Any advice to do this? > > >> Thank you > > >> > > >> Martin F > > >> ___ > > >> postgis-users mailing list > > >> postgis-users@postgis.refractions.net > > >> http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Create new lines from GPS points
Hi Martin. ST_Line_Substring(road, ST_Line_Locate_Point(road, gps_start), ST_Line_Locate_Point(road, gps_end)) AS highlight Gr Ralf Am Dienstag 11 Januar 2011, 17:46:06 schrieb Martin Fafard: > Ralf > > Yes, ok for the buffer. But how to "dynamically segment" my new road > from my original segment? > > Martin > > Ralf Suhr a écrit : > > Hi Martin, > > > > you will not get a correct solution for this problem. Your road network > > and the gps points differs always. > > > > A possible "solution" is building a buffer around the streets und look > > für intersection with gps points and filter by direction road/points. > > Grouping gps points can give you the start and end point for the road. > > If a road is only one times driven. > > > > Gr > > Ralf > > > > Am Dienstag 11 Januar 2011, 17:16:18 schrieb Martin Fafard: > >> Hi > >> > >> I have a network of roads (topological) and I receive GPS points. I > >> would like to create new lines who follow exactly the same path as my > >> road from the GPS points (to "highlight" where the GPS unit was on the > >> network). The problem is I need to segment the new line because the GPS > >> points can stop anywhere on my roads... Any advice to do this? > >> Thank you > >> > >> Martin F > >> ___ > >> postgis-users mailing list > >> postgis-users@postgis.refractions.net > >> http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Postgis related research subjects
Hi Martin, Sorry to come back to you so late. Did you find a subject? I have some questions which may be the subject of a master or a doctorate... They mostly relate to the way we store raster in PostGIS raster. Some of them: 1) What should look like a toolkit making transparent overlay operations on raster and vector? 2) How can we adapt existing raster algorythms to work with a discontinuous raster coverage the kind we can store and produce using PostGIS raster? 3) How can we use PostGIS (raster and vector) to generate and manipulate fuzzy boundary objects? 4) How can we use PostGIS raster objects to better simulate continuous objects having identities in simulation packages? I can develop further any of these subjects. Pierre >> my name is Martin Landa [1], I am working mostly on the GRASS >> project. I am studying for my PhD. at the Czech Technical University >> in Prague. One of the PhD. students of my supervisor is Pavel >> Stehule. Pavel is known in the PostgreSQL community very well. See >> blog of the core PostgreSQL developer Josh Berkus about Pavel [1]. >> Pavel seems that he would like to finish after some years his study. >> He is looking for the topic. >> >> My supervisor asked me for a help. I got idea to write you >> personally (sorry for bothering you). Would be interested for you to >> get Pavel working for PostGIS (raster or vector) for a while? In this >> case could you send me a list of topic which Pavel could work on (of >> course it need to me topic suitable for PhD. work). Feel free to >> resend this mail to the other core PostGIS developers and to ask them >> for ideas. ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Create new lines from GPS points
Ralf Yes, ok for the buffer. But how to "dynamically segment" my new road from my original segment? Martin Ralf Suhr a écrit : Hi Martin, you will not get a correct solution for this problem. Your road network and the gps points differs always. A possible "solution" is building a buffer around the streets und look für intersection with gps points and filter by direction road/points. Grouping gps points can give you the start and end point for the road. If a road is only one times driven. Gr Ralf Am Dienstag 11 Januar 2011, 17:16:18 schrieb Martin Fafard: Hi I have a network of roads (topological) and I receive GPS points. I would like to create new lines who follow exactly the same path as my road from the GPS points (to "highlight" where the GPS unit was on the network). The problem is I need to segment the new line because the GPS points can stop anywhere on my roads... Any advice to do this? Thank you Martin F ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Create new lines from GPS points
Hi Martin, you will not get a correct solution for this problem. Your road network and the gps points differs always. A possible "solution" is building a buffer around the streets und look für intersection with gps points and filter by direction road/points. Grouping gps points can give you the start and end point for the road. If a road is only one times driven. Gr Ralf Am Dienstag 11 Januar 2011, 17:16:18 schrieb Martin Fafard: > Hi > > I have a network of roads (topological) and I receive GPS points. I > would like to create new lines who follow exactly the same path as my > road from the GPS points (to "highlight" where the GPS unit was on the > network). The problem is I need to segment the new line because the GPS > points can stop anywhere on my roads... Any advice to do this? > Thank you > > Martin F > ___ > postgis-users mailing list > postgis-users@postgis.refractions.net > http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
[postgis-users] Create new lines from GPS points
Hi I have a network of roads (topological) and I receive GPS points. I would like to create new lines who follow exactly the same path as my road from the GPS points (to "highlight" where the GPS unit was on the network). The problem is I need to segment the new line because the GPS points can stop anywhere on my roads... Any advice to do this? Thank you Martin F ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
[postgis-users] Error Installation
Hi, I'm using Linux Suse SUSE Linux Enterprise Server 11 (ia64) 2.6.27.45-0.1-default kernel with databases version PostgreSQL 8.3. I've tried to install postgis version1.5.2 but receive an error message postg...@myhostname:~/postgis-1.5.2> make install make -C liblwgeom make[1]: Entering directory `/var/lib/pgsql/postgis-1.5.2/liblwgeom' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/var/lib/pgsql/postgis-1.5.2/liblwgeom' make -C postgis make[1]: Entering directory `/var/lib/pgsql/postgis-1.5.2/postgis' Makefile:80: /usr/local/pgsql/8.3/lib/pgxs/src/makefiles/pgxs.mk: No such file or directory make[1]: *** No rule to make target `/usr/local/pgsql/8.3/lib/pgxs/src/makefiles/pgxs.mk'. Stop. make[1]: Leaving directory `/var/lib/pgsql/postgis-1.5.2/postgis' make: *** [postgis] Error 2 Please advice me.. ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users