Re: AW: Re: Fwd: [Qgis-user] QGIS "Near"
Hi Martin, On 30/ott/2010, at 11:12, Martin Dobias wrote: > So as David already suggested, to ensure you are really working with > the nearest geometry, you should check the real distance. After the David's message I searched for a good solution which can work fine in every cases. So I resolved the issue using the further bbox border as search limit for the second phase. -- Giuseppe Sucameli___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user
Re: AW: Re: Fwd: [Qgis-user] QGIS "Near"
On Thu, Oct 28, 2010 at 7:48 AM, Ziegler Stefan wrote: > Hi Giuseppe > > thanks for looking into this. Do you think it's worth filling out a bug > report since the nearestNeighbor method does not the keep the promise or is > this the normal behaviour of a spatial index based method? Spatial index uses only the bounding boxes of geometries for two reasons: most importantly the intersection test (used when traversing the data structure) is much faster when compared to testing intersection of real geometry. Second, this would require spatial index to store all geometries - this memory overhead can be significant for bigger layers. So as David already suggested, to ensure you are really working with the nearest geometry, you should check the real distance. Regards Martin ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user
Re: AW: Re: Fwd: [Qgis-user] QGIS "Near"
Isn't a problem like this usually solved with a two-pass method. The first pass uses the spatial index to eliminate all of the features that could not possibly intersect/touch/etc. And then in the second pass, an actual (more expensive) spatial overlay operation is performed on those candidates to determine their true spatial relationships. David. On Thu, Oct 28, 2010 at 10:29 AM, Giuseppe Sucameli wrote: > Hi Stefan, > > On Thu, Oct 28, 2010 at 7:48 AM, Ziegler Stefan > wrote: >> >> thanks for looking into this. Do you think it's worth filling out a bug >> report since the nearestNeighbor method does not the keep the promise or is >> this the normal behaviour of a spatial index based method? > > I think we should fill a bug report because the nearestNeighbor doesn't work > as > expected. > I don't know if the QgsSpatialIndex can be improved to manage complex > geometries, > but AFAICS in the few inline comments within the code, in this moment it > manages only > Points, Lines and Regions (rectangles), so every polygonal geometry must be > converted to Regions. > > This issue could take a lot of time to be fixed, but we can use the ticket > to require > the documentation about the QgsSpatialIndex class. In this moment it's > missing. > > Cheers. > >> ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user
Re: AW: Re: Fwd: [Qgis-user] QGIS "Near"
Hi Stefan, On Thu, Oct 28, 2010 at 7:48 AM, Ziegler Stefan wrote: > thanks for looking into this. Do you think it's worth filling out a bug > report since the nearestNeighbor method does not the keep the promise or is > this the normal behaviour of a spatial index based method? > I think we should fill a bug report because the nearestNeighbor doesn't work as expected. I don't know if the QgsSpatialIndex can be improved to manage complex geometries, but AFAICS in the few inline comments within the code, in this moment it manages only Points, Lines and Regions (rectangles), so every polygonal geometry must be converted to Regions. This issue could take a lot of time to be fixed, but we can use the ticket to require the documentation about the QgsSpatialIndex class. In this moment it's missing. Cheers. > - Originalnachricht - > Von: "Giuseppe Sucameli" > Gesendet: Mit, 27.10.2010 17:30 > An: "Ziegler Stefan" > Cc: "Jim Hammack" ; qgis-user < > qgis-user@lists.osgeo.org> > Betreff: Re: AW: Re: Fwd: [Qgis-user] QGIS "Near" > > Hi Stefan, > your workaround works fine in my case! > > I looked at the QgsSpatialIndex code and I have bad news... It uses the > bounding box > of the geometries! > This means that your workaround can work in a lot of cases but not in all > cases, e.g. if > > > you have more than N geometries (10 considering your workaround), ones > inside > each other. > > Cheers. > > On Tue, Oct 26, 2010 at 6:47 PM, Ziegler Stefan > wrote: > > > > Hi Giuseppe > > > > I wrote a little workaround. Could you please update to 0.0.6 and check it > with your test case? Thanks. > > > > regards > > Stefan > > > > mit freundlichem Gruss > > Stefan Ziegler > > > > > > ----- Originalnachricht - > > Von: "Giuseppe Sucameli" > > Gesendet: Mon, 25.10.2010 14:09 > > An: "Ziegler Stefan" > > Cc: "Jim Hammack" ; qgis-user < > qgis-user@lists.osgeo.org> > > > > Betreff: Re: AW: Re: Fwd: [Qgis-user] QGIS "Near" > > > > Hi all, > > > > two days ago I wrote a similar plugin for a LD talk in Pisa. > > I was unaware of the QgsSpatialIndex class (seems there's no documentation > > about it in the online QGis API pages or maybe I missed it) so I wrote a > simple > > > > > > loop to find the closest feature. > > > > Now I tried also the Nearest plugin and they are different behavior! > > See the scheenshots [1] [2]. > > > > AFAICS, Nearest select a wrong polygon. > > I see the plugin's code and I think it could a QgsSpatialIndex bug, but it > could be > > > > > > also the normal behaviour (I didn't found its documentation on the API > pages > > so I don't know). > > > > I'm going to add my plugin (ClosestFeatureFinded) to the Faunalia repo so > you > > can try it and check the different behavior. > > > > > > > > I hope this can help to find the bug (if any). > > If you confirm it, I'll fill a bug report. > > > > Cheers. > > > > [1] http://img87.imageshack.us/img87/3232/nearest.jpg > > > > > > [2] http://img64.imageshack.us/img64/2066/closest.jpg > > > > On Fri, Oct 22, 2010 at 9:19 AM, Ziegler Stefan > wrote: > > > > > > there is some strange behaviour when using it with polygon features (at > least I think it's a bit strange): sometimes when you click into a polygon I > would expect that it selects the polygon I clicked into but it selects an > adjacent polygon. This is probably due to the nearestNeighbor method of the > spatial index. Since the two neighboring polygons share a common border the > distance would be equal but the spatial index does not check if the > coordindates of the mouse click lies within one of the two polygons. > > > > > > > > > > > > > > > regards > > > > Stefan > > > > > > > > mit freundlichem Gruss > > > > Stefan Ziegler > > > > > > > > > > > > - Originalnachricht - > > > > Von: "Jim Hammack" > > > > Gesendet: Don, 21.10.2010 19:20 > > > > An: "Ziegler Stefan" > > > > Cc: qgis-user > > > > Betreff: Re: AW: Re: Fwd: [Qgis-user] QGIS "Near" > > > > > > > > > > > >Stefan, > > > > > > > > > > > > > > > > I was looking
AW: AW: Re: Fwd: [Qgis-user] QGIS "Near"
Hi Giuseppe thanks for looking into this. Do you think it's worth filling out a bug report since the nearestNeighbor method does not the keep the promise or is this the normal behaviour of a spatial index based method? regards Stefan mit freundlichem Gruss Stefan Ziegler - Originalnachricht - Von: "Giuseppe Sucameli" Gesendet: Mit, 27.10.2010 17:30 An: "Ziegler Stefan" Cc: "Jim Hammack" ; qgis-user Betreff: Re: AW: Re: Fwd: [Qgis-user] QGIS "Near" Hi Stefan, your workaround works fine in my case! I looked at the QgsSpatialIndex code and I have bad news... It uses the bounding box of the geometries! This means that your workaround can work in a lot of cases but not in all cases, e.g. if you have more than N geometries (10 considering your workaround), ones inside each other. Cheers. On Tue, Oct 26, 2010 at 6:47 PM, Ziegler Stefan wrote: Hi Giuseppe I wrote a little workaround. Could you please update to 0.0.6 and check it with your test case? Thanks. regards Stefan mit freundlichem Gruss Stefan Ziegler - Originalnachricht - Von: "Giuseppe Sucameli" Gesendet: Mon, 25.10.2010 14:09 An: "Ziegler Stefan" Cc: "Jim Hammack" ; qgis-user Betreff: Re: AW: Re: Fwd: [Qgis-user] QGIS "Near" Hi all, two days ago I wrote a similar plugin for a LD talk in Pisa. I was unaware of the QgsSpatialIndex class (seems there's no documentation about it in the online QGis API pages or maybe I missed it) so I wrote a simple loop to find the closest feature. Now I tried also the Nearest plugin and they are different behavior! See the scheenshots [1] [2]. AFAICS, Nearest select a wrong polygon. I see the plugin's code and I think it could a QgsSpatialIndex bug, but it could be also the normal behaviour (I didn't found its documentation on the API pages so I don't know). I'm going to add my plugin (ClosestFeatureFinded) to the Faunalia repo so you can try it and check the different behavior. I hope this can help to find the bug (if any). If you confirm it, I'll fill a bug report. Cheers. [1] http://img87.imageshack.us/img87/3232/nearest.jpg [2] http://img64.imageshack.us/img64/2066/closest.jpg On Fri, Oct 22, 2010 at 9:19 AM, Ziegler Stefan wrote: there is some strange behaviour when using it with polygon features (at least I think it's a bit strange): sometimes when you click into a polygon I would expect that it selects the polygon I clicked into but it selects an adjacent polygon. This is probably due to the nearestNeighbor method of the spatial index. Since the two neighboring polygons share a common border the distance would be equal but the spatial index does not check if the coordindates of the mouse click lies within one of the two polygons. regards Stefan mit freundlichem Gruss Stefan Ziegler - Originalnachricht ----- Von: "Jim Hammack" Gesendet: Don, 21.10.2010 19:20 An: "Ziegler Stefan" Cc: qgis-user Betreff: Re: AW: Re: Fwd: [Qgis-user] QGIS "Near" Stefan, I was looking for the same functionality as Zoran so have also been working with your "Nearest" plugin. It is exactly what I need and seems to work well. Thanks! Jim On 10/20/2010 01:54 PM, Ziegler Stefan wrote: Hi Zoran I had some time left, took all my code snippets and also the one from Carson. Please try the plugin "Nearest" that should cover your example 1: http://www.catais.org/qgis/plugins.xml regards Stefan -Ursprüngliche Nachricht- Von: Zoran Jankovic [mailto:zoran.janko...@zisis.hr] Gesendet am: Mittwoch, 20. Oktober 2010 19:21 An: qgis-user Betreff: Re: Fwd: [Qgis-user] QGIS "Near" Hi Joe, On Wed, Oct 20, 2010 at 5:06 PM, Joe Larson wrote: Does the function 'snapWithContext' http://doc.qgis.org/head/classQgsVectorLayer.html#733b974dce13d587e05cf3d4fc24f208 which "Snaps to segment or vertex within given tolerance." seem like what you're looking for? I came across it while trying to get Quantum Navigator working recently...seemed relative, but I'm no
AW: AW: Re: Fwd: [Qgis-user] QGIS "Near"
Hi Giuseppe I wrote a little workaround. Could you please update to 0.0.6 and check it with your test case? Thanks. regards Stefan mit freundlichem Gruss Stefan Ziegler - Originalnachricht - Von: "Giuseppe Sucameli" Gesendet: Mon, 25.10.2010 14:09 An: "Ziegler Stefan" Cc: "Jim Hammack" ; qgis-user Betreff: Re: AW: Re: Fwd: [Qgis-user] QGIS "Near" Hi all, two days ago I wrote a similar plugin for a LD talk in Pisa. I was unaware of the QgsSpatialIndex class (seems there's no documentation about it in the online QGis API pages or maybe I missed it) so I wrote a simple loop to find the closest feature. Now I tried also the Nearest plugin and they are different behavior! See the scheenshots [1] [2]. AFAICS, Nearest select a wrong polygon. I see the plugin's code and I think it could a QgsSpatialIndex bug, but it could be also the normal behaviour (I didn't found its documentation on the API pages so I don't know). I'm going to add my plugin (ClosestFeatureFinded) to the Faunalia repo so you can try it and check the different behavior. I hope this can help to find the bug (if any). If you confirm it, I'll fill a bug report. Cheers. [1] http://img87.imageshack.us/img87/3232/nearest.jpg [2] http://img64.imageshack.us/img64/2066/closest.jpg On Fri, Oct 22, 2010 at 9:19 AM, Ziegler Stefan wrote: there is some strange behaviour when using it with polygon features (at least I think it's a bit strange): sometimes when you click into a polygon I would expect that it selects the polygon I clicked into but it selects an adjacent polygon. This is probably due to the nearestNeighbor method of the spatial index. Since the two neighboring polygons share a common border the distance would be equal but the spatial index does not check if the coordindates of the mouse click lies within one of the two polygons. regards Stefan mit freundlichem Gruss Stefan Ziegler - Originalnachricht - Von: "Jim Hammack" Gesendet: Don, 21.10.2010 19:20 An: "Ziegler Stefan" Cc: qgis-user Betreff: Re: AW: Re: Fwd: [Qgis-user] QGIS "Near" Stefan, I was looking for the same functionality as Zoran so have also been working with your "Nearest" plugin. It is exactly what I need and seems to work well. Thanks! Jim On 10/20/2010 01:54 PM, Ziegler Stefan wrote: Hi Zoran I had some time left, took all my code snippets and also the one from Carson. Please try the plugin "Nearest" that should cover your example 1: http://www.catais.org/qgis/plugins.xml regards Stefan -Ursprüngliche Nachricht- Von: Zoran Jankovic [mailto:zoran.janko...@zisis.hr] Gesendet am: Mittwoch, 20. Oktober 2010 19:21 An: qgis-user Betreff: Re: Fwd: [Qgis-user] QGIS "Near" Hi Joe, On Wed, Oct 20, 2010 at 5:06 PM, Joe Larson wrote: Does the function 'snapWithContext' http://doc.qgis.org/head/classQgsVectorLayer.html#733b974dce13d587e05cf3d4fc24f208 which "Snaps to segment or vertex within given tolerance." seem like what you're looking for? I came across it while trying to get Quantum Navigator working recently...seemed relative, but I'm no expert! This is similar to the mentioned solution with selecting by radius, or changing the tolerance of ID tool. Close, but no cigar. Since this is not very urgent, I've decided to continue pursuing that outlined solution Carson gave, and write a plugin i Python based on that. Since I actually never used Python before, it may take a while, but hey, I get to learn sth. new :-). I never got the word back from Carson, has he developed anything along these lines, but I have to presume he didn't... Anyone interested in joning me, or even earning some money, is still invited to jump on board. My GIS implementation project is well on the way, and it seems there'll even be some money involved :-). Zoran ~joe On Tue, Oct 19, 2010 at 9:55 AM, Andreas Neumann wrote: > Hi Zoran,
AW: AW: Re: Fwd: [Qgis-user] QGIS "Near"
Hi I'm also quite sure there is some unexpected behaviour in the QgsSpatialIndex.nearestNeighbor() method. The two screenshots look a bit like it has something to do with the bounding box? regards Stefan mit freundlichem Gruss Stefan Ziegler - Originalnachricht - Von: "Giuseppe Sucameli" Gesendet: Mon, 25.10.2010 14:09 An: "Ziegler Stefan" Cc: "Jim Hammack" ; qgis-user Betreff: Re: AW: Re: Fwd: [Qgis-user] QGIS "Near" Hi all, two days ago I wrote a similar plugin for a LD talk in Pisa. I was unaware of the QgsSpatialIndex class (seems there's no documentation about it in the online QGis API pages or maybe I missed it) so I wrote a simple loop to find the closest feature. Now I tried also the Nearest plugin and they are different behavior! See the scheenshots [1] [2]. AFAICS, Nearest select a wrong polygon. I see the plugin's code and I think it could a QgsSpatialIndex bug, but it could be also the normal behaviour (I didn't found its documentation on the API pages so I don't know). I'm going to add my plugin (ClosestFeatureFinded) to the Faunalia repo so you can try it and check the different behavior. I hope this can help to find the bug (if any). If you confirm it, I'll fill a bug report. Cheers. [1] http://img87.imageshack.us/img87/3232/nearest.jpg [2] http://img64.imageshack.us/img64/2066/closest.jpg On Fri, Oct 22, 2010 at 9:19 AM, Ziegler Stefan wrote: there is some strange behaviour when using it with polygon features (at least I think it's a bit strange): sometimes when you click into a polygon I would expect that it selects the polygon I clicked into but it selects an adjacent polygon. This is probably due to the nearestNeighbor method of the spatial index. Since the two neighboring polygons share a common border the distance would be equal but the spatial index does not check if the coordindates of the mouse click lies within one of the two polygons. regards Stefan mit freundlichem Gruss Stefan Ziegler - Originalnachricht - Von: "Jim Hammack" Gesendet: Don, 21.10.2010 19:20 An: "Ziegler Stefan" Cc: qgis-user Betreff: Re: AW: Re: Fwd: [Qgis-user] QGIS "Near" Stefan, I was looking for the same functionality as Zoran so have also been working with your "Nearest" plugin. It is exactly what I need and seems to work well. Thanks! Jim On 10/20/2010 01:54 PM, Ziegler Stefan wrote: Hi Zoran I had some time left, took all my code snippets and also the one from Carson. Please try the plugin "Nearest" that should cover your example 1: http://www.catais.org/qgis/plugins.xml regards Stefan -Ursprüngliche Nachricht- Von: Zoran Jankovic [mailto:zoran.janko...@zisis.hr] Gesendet am: Mittwoch, 20. Oktober 2010 19:21 An: qgis-user Betreff: Re: Fwd: [Qgis-user] QGIS "Near" Hi Joe, On Wed, Oct 20, 2010 at 5:06 PM, Joe Larson wrote: Does the function 'snapWithContext' http://doc.qgis.org/head/classQgsVectorLayer.html#733b974dce13d587e05cf3d4fc24f208 which "Snaps to segment or vertex within given tolerance." seem like what you're looking for? I came across it while trying to get Quantum Navigator working recently...seemed relative, but I'm no expert! This is similar to the mentioned solution with selecting by radius, or changing the tolerance of ID tool. Close, but no cigar. Since this is not very urgent, I've decided to continue pursuing that outlined solution Carson gave, and write a plugin i Python based on that. Since I actually never used Python before, it may take a while, but hey, I get to learn sth. new :-). I never got the word back from Carson, has he developed anything along these lines, but I have to presume he didn't... Anyone interested in joning me, or even earning some money, is still invited to jump on board. My GIS implementation project is well on the way, and it seems there'll even be some money involved :-). Zoran ~joe On Tue, Oct 19, 2010 at 9:55 AM, Andreas Neumann
Re: AW: Re: Fwd: [Qgis-user] QGIS "Near"
Hi all, two days ago I wrote a similar plugin for a LD talk in Pisa. I was unaware of the QgsSpatialIndex class (seems there's no documentation about it in the online QGis API pages or maybe I missed it) so I wrote a simple loop to find the closest feature. Now I tried also the Nearest plugin and they are different behavior! See the scheenshots [1] [2]. AFAICS, Nearest select a wrong polygon. I see the plugin's code and I think it could a QgsSpatialIndex bug, but it could be also the normal behaviour (I didn't found its documentation on the API pages so I don't know). I'm going to add my plugin (ClosestFeatureFinded) to the Faunalia repo so you can try it and check the different behavior. I hope this can help to find the bug (if any). If you confirm it, I'll fill a bug report. Cheers. [1] http://img87.imageshack.us/img87/3232/nearest.jpg [2] http://img64.imageshack.us/img64/2066/closest.jpg On Fri, Oct 22, 2010 at 9:19 AM, Ziegler Stefan wrote: > there is some strange behaviour when using it with polygon features (at > least I think it's a bit strange): sometimes when you click into a polygon I > would expect that it selects the polygon I clicked into but it selects an > adjacent polygon. This is probably due to the nearestNeighbor method of the > spatial index. Since the two neighboring polygons share a common border the > distance would be equal but the spatial index does not check if the > coordindates of the mouse click lies within one of the two polygons. > > regards > Stefan > > mit freundlichem Gruss > Stefan Ziegler > > > - Originalnachricht - > Von: "Jim Hammack" > Gesendet: Don, 21.10.2010 19:20 > An: "Ziegler Stefan" > Cc: qgis-user > Betreff: Re: AW: Re: Fwd: [Qgis-user] QGIS "Near" > > >Stefan, > > > > I was looking for the same functionality as Zoran so have >also been working with your "Nearest" plugin. It is exactly >what I need and seems to work well. > > > >Thanks! > >Jim > > > >On 10/20/2010 01:54 PM, Ziegler Stefan wrote: > > > Hi Zoran > > > > I had some time left, took all >my code snippets and also the one from Carson. Please try >the plugin "Nearest" that should cover your example 1: > > > > http://www.catais.org/qgis/plugins.xml > > > > regards > > Stefan > > >-Ursprüngliche >Nachricht- > >Von: Zoran Jankovic [mailto:zoran.janko...@zisis.hr] > >Gesendet am: Mittwoch, 20. Oktober 2010 19:21 > >An: qgis-user > >Betreff: Re: Fwd: [Qgis-user] QGIS "Near" > > > > Hi Joe, > > > > > > > On Wed, Oct 20, 2010 at 5:06 PM, Joe >Larson >wrote: > > > Does the function 'snapWithContext' > > > http://doc.qgis.org/head/classQgsVectorLayer.html#733b974dce13d587e05cf3d4fc24f208 > > which "Snaps to segment or vertex within given tolerance." > seem like > > what you're looking for? I came across it while trying to > get Quantum > > Navigator working recently...seemed relative, but I'm no > expert! > > > > > > > >This is similar to the mentioned solution with > selecting by radius, or changing the tolerance of ID tool. > Close, but no cigar. Since this is not very urgent, I've > decided to continue pursuing that outlined solution Carson > gave, and write a plugin i Python based on that. Since I > actually never used Python before, it may take a while, > but hey, I get to learn sth. new :-). > >I never got the word back from Carson, has he developed > anything along these lines, but I have to presume he > didn't... > >Anyone interested in joning me, or even earning some > money, is still invited to jump on board. My GIS > implementation project is well on the way, and it seems > there'll even be some money involved :-). > > > >Zoran > > > > > > ~joe > > > > On Tue, Oct 19, 2010 at 9:55 AM, Andreas Neumann > wrote: > > > > > > Hi Zoran, >
Re: AW: AW: Re: Fwd: [Qgis-user] QGIS "Near"
Stefan, Yes, I see that now. I was using only points before and never tried clicking inside a polygon. I wouldn't think that would be a very common event, though. Jim On 10/22/2010 02:19 AM, Ziegler Stefan wrote: Hi there is some strange behaviour when using it with polygon features (at least I think it's a bit strange): sometimes when you click into a polygon I would expect that it selects the polygon I clicked into but it selects an adjacent polygon. This is probably due to the nearestNeighbor method of the spatial index. Since the two neighboring polygons share a common border the distance would be equal but the spatial index does not check if the coordindates of the mouse click lies within one of the two polygons. regards Stefan mit freundlichem Gruss Stefan Ziegler - Originalnachricht - Von: "Jim Hammack" Gesendet: Don, 21.10.2010 19:20 An: "Ziegler Stefan" Cc: qgis-user Betreff: Re: AW: Re: Fwd: [Qgis-user] QGIS "Near" Stefan, I was looking for the same functionality as Zoran so have also been working with your "Nearest" plugin. It is exactly what I need and seems to work well. Thanks! Jim On 10/20/2010 01:54 PM, Ziegler Stefan wrote: Hi Zoran I had some time left, took all my code snippets and also the one from Carson. Please try the plugin "Nearest" that should cover your example 1: http://www.catais.org/qgis/plugins.xml regards Stefan -Ursprüngliche Nachricht- Von: Zoran Jankovic [mailto:zoran.janko...@zisis.hr] Gesendet am: Mittwoch, 20. Oktober 2010 19:21 An: qgis-user Betreff: Re: Fwd: [Qgis-user] QGIS "Near" Hi Joe, On Wed, Oct 20, 2010 at 5:06 PM, Joe Larson wrote: Does the function 'snapWithContext' http://doc.qgis.org/head/classQgsVectorLayer.html#733b974dce13d587e05cf3d4fc24f208 which "Snaps to segment or vertex within given tolerance." seem like what you're looking for? I came across it while trying to get Quantum Navigator working recently...seemed relative, but I'm no expert! This is similar to the mentioned solution with selecting by radius, or changing the tolerance of ID tool. Close, but no cigar. Since this is not very urgent, I've decided to continue pursuing that outlined solution Carson gave, and write a plugin i Python based on that. Since I actually never used Python before, it may take a while, but hey, I get to learn sth. new :-). I never got the word back from Carson, has he developed anything along these lines, but I have to presume he didn't... Anyone interested in joning me, or even earning some money, is still invited to jump on board. My GIS implementation project is well on the way, and it seems there'll even be some money involved :-). Zoran ~joe On Tue, Oct 19, 2010 at 9:55 AM, Andreas Neumann wrote: > Hi Zoran, > > I believe the infrastructure of what you want is already wihtin the > selection and identify tools in QGIS. Isn't this almost implemented in the > current identify tool? > > It sort of is, but not completely. Identify will ID all the features within certain radios (percentage of extent), but it will ID _all_ of the features within this radius. I only need the nearest, no matter how far away... Let us say it is, for simplicity, within current extent. > The current identify tool selects "ne
AW: AW: Re: Fwd: [Qgis-user] QGIS "Near"
Hi there is some strange behaviour when using it with polygon features (at least I think it's a bit strange): sometimes when you click into a polygon I would expect that it selects the polygon I clicked into but it selects an adjacent polygon. This is probably due to the nearestNeighbor method of the spatial index. Since the two neighboring polygons share a common border the distance would be equal but the spatial index does not check if the coordindates of the mouse click lies within one of the two polygons. regards Stefan mit freundlichem Gruss Stefan Ziegler - Originalnachricht - Von: "Jim Hammack" Gesendet: Don, 21.10.2010 19:20 An: "Ziegler Stefan" Cc: qgis-user Betreff: Re: AW: Re: Fwd: [Qgis-user] QGIS "Near" Stefan, I was looking for the same functionality as Zoran so have also been working with your "Nearest" plugin. It is exactly what I need and seems to work well. Thanks! Jim On 10/20/2010 01:54 PM, Ziegler Stefan wrote: Hi Zoran I had some time left, took all my code snippets and also the one from Carson. Please try the plugin "Nearest" that should cover your example 1: http://www.catais.org/qgis/plugins.xml regards Stefan -Ursprüngliche Nachricht- Von: Zoran Jankovic [mailto:zoran.janko...@zisis.hr] Gesendet am: Mittwoch, 20. Oktober 2010 19:21 An: qgis-user Betreff: Re: Fwd: [Qgis-user] QGIS "Near" Hi Joe, On Wed, Oct 20, 2010 at 5:06 PM, Joe Larson wrote: Does the function 'snapWithContext' http://doc.qgis.org/head/classQgsVectorLayer.html#733b974dce13d587e05cf3d4fc24f208 which "Snaps to segment or vertex within given tolerance." seem like what you're looking for? I came across it while trying to get Quantum Navigator working recently...seemed relative, but I'm no expert! This is similar to the mentioned solution with selecting by radius, or changing the tolerance of ID tool. Close, but no cigar. Since this is not very urgent, I've decided to continue pursuing that outlined solution Carson gave, and write a plugin i Python based on that. Since I actually never used Python before, it may take a while, but hey, I get to learn sth. new :-). I never got the word back from Carson, has he developed anything along these lines, but I have to presume he didn't... Anyone interested in joning me, or even earning some money, is still invited to jump on board. My GIS implementation project is well on the way, and it seems there'll even be some money involved :-). Zoran ~joe On Tue, Oct 19, 2010 at 9:55 AM, Andreas Neumann wrote: > Hi Zoran, > > I believe the infrastructure of what you want is already wihtin the > selection and identify tools in QGIS. Isn't this almost implemented in the > current identify tool? > > It sort of is, but not completely. Identify will ID all the features within certain radios (percentage of extent), but it will ID _all_ of the features within this radius. I only need the nearest, no matter how far away... Let us say it is, for simplicity, within current extent. > The current identify tool selects "near" or "close by" features within a > certain tolerance. This tolerance can be set in "Options" --> "Map tools" > "search radius". I believe it currently only effects the identify tool. Do
Re: AW: Re: Fwd: [Qgis-user] QGIS "Near"
Stefan, I was looking for the same functionality as Zoran so have also been working with your "Nearest" plugin. It is exactly what I need and seems to work well. Thanks! Jim On 10/20/2010 01:54 PM, Ziegler Stefan wrote: Hi Zoran I had some time left, took all my code snippets and also the one from Carson. Please try the plugin "Nearest" that should cover your example 1: http://www.catais.org/qgis/plugins.xml regards Stefan -Ursprüngliche Nachricht- Von: Zoran Jankovic [mailto:zoran.janko...@zisis.hr] Gesendet am: Mittwoch, 20. Oktober 2010 19:21 An: qgis-user Betreff: Re: Fwd: [Qgis-user] QGIS "Near" Hi Joe, On Wed, Oct 20, 2010 at 5:06 PM, Joe Larsonwrote: Does the function 'snapWithContext' http://doc.qgis.org/head/classQgsVectorLayer.html#733b974dce13d587e05cf3d4fc24f208 which "Snaps to segment or vertex within given tolerance." seem like what you're looking for? I came across it while trying to get Quantum Navigator working recently...seemed relative, but I'm no expert! This is similar to the mentioned solution with selecting by radius, or changing the tolerance of ID tool. Close, but no cigar. Since this is not very urgent, I've decided to continue pursuing that outlined solution Carson gave, and write a plugin i Python based on that. Since I actually never used Python before, it may take a while, but hey, I get to learn sth. new :-). I never got the word back from Carson, has he developed anything along these lines, but I have to presume he didn't... Anyone interested in joning me, or even earning some money, is still invited to jump on board. My GIS implementation project is well on the way, and it seems there'll even be some money involved :-). Zoran ~joe On Tue, Oct 19, 2010 at 9:55 AM, Andreas Neumann carto.net>wrote: > Hi Zoran, > > I believe the infrastructure of what you want is already wihtin the > selection and identify tools in QGIS. Isn't this almost implemented in the > current identify tool? > > It sort of is, but not completely. Identify will ID all the features within certain radios (percentage of extent), but it will ID _all_ of the features within this radius. I only need the nearest, no matter how far away... Let us say it is, for simplicity, within current extent. > The current identify tool selects "near" or "close by" features within a > certain tolerance. This tolerance can be set in "Options" --> "Map tools" > "search radius". I believe it currently only effects the identify tool. Do > you want the same tolerance also be used for the click-selection tool? > > Look above. This could be useful, but it is not the functionality I'm currently looking after. > Are you also aware that in QGIS 1.6 there are new selection tools? > > * by click > * by rectangle > * by polygon > * by freehand > * by radius > > Yup, these are great, but they all select _multiple_ features within radius, rectangle, etc. > Maybe this also helps to address your needs? > > Of course you can
AW: Re: AW: Re: Fwd: [Qgis-user] QGIS "Near"
Shame on me... Please update the plugin (0.0.3) and try again. regards Stefan > -Ursprüngliche Nachricht- > Von: Ricardo Filipe Soares Garcia da > [mailto:ricardo.garcia.si...@gmail.com] > Gesendet am: Donnerstag, 21. Oktober 2010 15:19 > An: qgis-user > Betreff: Re: AW: Re: Fwd: [Qgis-user] QGIS "Near" > > It is happening to me as well (Ubuntu 10.10, Qgis 1.5 from > ubuntugis-unstable ppa) > > > I have installed the plugin on qgis trunk and Ubuntu 10.04, and now > > every time I exit qgis I get the following > > > > Traceback (most recent call last): > > File "/usr/lib/python2.6/dist-packages/qgis/utils.py", line 187, in > > unloadPlugin > >plugins[packageName].unload() > > File "/home/gio/.qgis/python/plugins/nearest/nearest.py", > line 102, in > > unload > >QObject.disconnect(self.tool, SIGNAL("featureFound()"), > > self.selectFeature) > > AttributeError: Nearest instance has no attribute 'tool' > > > -- > ___ ___ __ > Ricardo Garcia Silva > ___ > Qgis-user mailing list > Qgis-user@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/qgis-user > ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user
Re: AW: Re: Fwd: [Qgis-user] QGIS "Near"
It is happening to me as well (Ubuntu 10.10, Qgis 1.5 from ubuntugis-unstable ppa) > I have installed the plugin on qgis trunk and Ubuntu 10.04, and now > every time I exit qgis I get the following > > Traceback (most recent call last): > File "/usr/lib/python2.6/dist-packages/qgis/utils.py", line 187, in > unloadPlugin > plugins[packageName].unload() > File "/home/gio/.qgis/python/plugins/nearest/nearest.py", line 102, in > unload > QObject.disconnect(self.tool, SIGNAL("featureFound()"), > self.selectFeature) > AttributeError: Nearest instance has no attribute 'tool' -- ___ ___ __ Ricardo Garcia Silva ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user
Re: AW: Re: Fwd: [Qgis-user] QGIS "Near"
Hi, I have installed the plugin on qgis trunk and Ubuntu 10.04, and now every time I exit qgis I get the following Traceback (most recent call last): File "/usr/lib/python2.6/dist-packages/qgis/utils.py", line 187, in unloadPlugin plugins[packageName].unload() File "/home/gio/.qgis/python/plugins/nearest/nearest.py", line 102, in unload QObject.disconnect(self.tool, SIGNAL("featureFound()"), self.selectFeature) AttributeError: Nearest instance has no attribute 'tool' cheers -- Giovanni -- On Thu, 2010-10-21 at 10:22 +0200, Ziegler Stefan wrote: > Hi Zoran > > > As I can see the main stuff is in "featurefindertool.py"? And it works > > through all the features in the selected layer every time? > Yes, the interesting stuff is in featurefindertool.py. Yes, it works through > all the features in the selected layer. > > > > But, I really do not have that many features, and it takes 2-3 seconds to > > find the nearest feature on my, not so very new laptop, > > in a layer with cca 4200 point features.Ok, this is due to the spatial > > index that is build everytime you click on the map. I changed this > > behaviour; the index is build only for the first time (or when you change > > the current layer of course). It takes 3 secondes for 50'000 point features > > and 40 seconds for 600'000 point features for the first search (on our > > server). The second click/search is just "real-time". Please update the > > plugin and try it and let me know. > > regards > Stefan > > > > > > > On Wed, Oct 20, 2010 at 8:54 PM, Ziegler Stefan > wrote: > > > > > > > Hi > Zoran > > > > I had > some time left, took all my code snippets and also the one from Carson. > Please > try the plugin "Nearest" that should cover your example 1: > > > > http://www.catais.org/qgis/plugins.xml > > > > regards > > Stefan > > > > -Ursprüngliche > Nachricht- > > Von: Zoran Jankovic > [mailto:zoran.janko...@zisis.hr] > > Gesendet am: Mittwoch, 20. Oktober > 2010 19:21 > > An: qgis-user > > Betreff: Re: Fwd: [Qgis-user] > QGIS "Near" > > > > > Hi Joe, > > > > > > > > > On Wed, Oct 20, 2010 at 5:06 PM, Joe Larson wrote: > > > > > Does > the function 'snapWithContext' > > http://doc.qgis.org/head/classQgsVectorLayer.html#733b974dce13d587e05cf3d4fc24f208 > > which > "Snaps to segment or vertex within given tolerance." seem like > > what > you're looking for? I came across it while trying to get > Quantum > > Navigator working recently...seemed relative, but I'm no > expert! > > > > > > > > > > This is similar to the mentioned solution with selecting by radius, or > changing the tolerance of ID tool. Close, but no cigar. Since this is not > very > urgent, I've decided to continue pursuing that outlined solution Carson > gave, > and write a plugin i Python based on that. Since I actually never used > Python > before, it may take a while, but hey, I get to learn sth. new :-). > > I never got the word back from Carson, has he developed anything along > these lines, but I have to presume he didn't... > > Anyone interested in joning me, or even earning some money, is still > invited to jump on board. My GIS implementation project is well on the way, > and it seems there'll even be some money involved :-). > > > > Zoran > > > > > > ~joe > > > > On > Tue, Oct 19, 2010 at 9:55 AM, Andreas Neumann carto.net>wrote: > > > > > > > > > Hi Zoran, > > > > > > I believe the > infrastructure of what you want is already wihtin the > > > selection and > identify tools in QGIS. Isn't this almost implemented in the > > > current > identify tool? > > > > > > > > It sort of is, but not completely. > Identify will ID all the features within > > certain radios (percentage of > extent), but it will ID _all_ of the features > > within this radius. I only > need the nearest, no matter how far away... Let > > us say it is, for > simplicity, within current extent. > > > > > > > The current identify tool > selects "near" or "close by" features within a > > > certain tolerance. > This tolerance can be set in "Options" --> "Map tools" > > > "search > radius". I believe it currently only effects the identify tool. Do > > > > you want the same tolerance also be used for the click-selection > tool? > > > > > > > > Look above. This could be useful, but it is not the > functionality I'm > > currently looking after. > > > > > > > Are you also > aware that in QGIS 1.6 there are new selection tools? > > > > > > * by > click > > > * by rectangle > > > * by polygon > > > * by > freehand > > > * by radius > > > > > > > > Yup, these are great, but > they all select _multiple_ features within radius, > > rectangle, > etc. > > > > > > > May
AW: Re: Fwd: [Qgis-user] QGIS "Near"
Hi Zoran > As I can see the main stuff is in "featurefindertool.py"? And it works > through all the features in the selected layer every time? Yes, the interesting stuff is in featurefindertool.py. Yes, it works through all the features in the selected layer. > But, I really do not have that many features, and it takes 2-3 seconds to > find the nearest feature on my, not so very new laptop, > in a layer with cca 4200 point features.Ok, this is due to the spatial index > that is build everytime you click on the map. I changed this behaviour; the > index is build only for the first time (or when you change the current layer > of course). It takes 3 secondes for 50'000 point features and 40 seconds for > 600'000 point features for the first search (on our server). The second > click/search is just "real-time". Please update the plugin and try it and let > me know. regards Stefan On Wed, Oct 20, 2010 at 8:54 PM, Ziegler Stefan wrote: Hi Zoran I had some time left, took all my code snippets and also the one from Carson. Please try the plugin "Nearest" that should cover your example 1: http://www.catais.org/qgis/plugins.xml regards Stefan -Ursprüngliche Nachricht- Von: Zoran Jankovic [mailto:zoran.janko...@zisis.hr] Gesendet am: Mittwoch, 20. Oktober 2010 19:21 An: qgis-user Betreff: Re: Fwd: [Qgis-user] QGIS "Near" Hi Joe, On Wed, Oct 20, 2010 at 5:06 PM, Joe Larson wrote: Does the function 'snapWithContext' http://doc.qgis.org/head/classQgsVectorLayer.html#733b974dce13d587e05cf3d4fc24f208 which "Snaps to segment or vertex within given tolerance." seem like what you're looking for? I came across it while trying to get Quantum Navigator working recently...seemed relative, but I'm no expert! This is similar to the mentioned solution with selecting by radius, or changing the tolerance of ID tool. Close, but no cigar. Since this is not very urgent, I've decided to continue pursuing that outlined solution Carson gave, and write a plugin i Python based on that. Since I actually never used Python before, it may take a while, but hey, I get to learn sth. new :-). I never got the word back from Carson, has he developed anything along these lines, but I have to presume he didn't... Anyone interested in joning me, or even earning some money, is still invited to jump on board. My GIS implementation project is well on the way, and it seems there'll even be some money involved :-). Zoran ~joe On Tue, Oct 19, 2010 at 9:55 AM, Andreas Neumann wrote: > Hi Zoran, > > I believe the infrastructure of what you want is already wihtin the > selection and identify tools in QGIS. Isn't this almost implemented in the > current identify tool? > > It sort of is, but not completely. Identify will ID all the features within certain radios (percentage of extent), but it will ID _all_ of the features within this radius. I only need the nearest, no matter how far away... Let us say it is, for simplicity, within current extent. > The current identify tool selects "near" or "close by" features within a > certain tolerance. This tolerance can be set in "Options" --> "Map tools" > "search radius". I believe it currently only effects the identify tool. Do > you want the same tolerance also be used for the click-selection tool? > > Look above. This could be useful, but it is not the functionality I'm currently looking after. > Are you also aware that in QGIS 1.6 there are new selection tools? > > * by click > * by rectangle > * by polygon > * by freehand > * by radius > > Yup, these are great, but they all select _multiple_ features within radius, rectangle, etc. > Maybe this also helps to address your needs? > > Of course you can combine it with previous selections by pressing the ctrl > key. > > BR, --- Zoran Jankovic ZIS-Izrada softvera i savjetovanje / ZIS - Software Development and Consulting http://www.zisis.hr M: 00 385 98 682 902 T: 00 385 44 683 374 A. Senoe 4 44320 Kutina Croatia ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user
AW: Re: Fwd: [Qgis-user] QGIS "Near"
Hi Zoran I had some time left, took all my code snippets and also the one from Carson. Please try the plugin "Nearest" that should cover your example 1: http://www.catais.org/qgis/plugins.xml regards Stefan -Ursprüngliche Nachricht- Von: Zoran Jankovic [mailto:zoran.janko...@zisis.hr] Gesendet am: Mittwoch, 20. Oktober 2010 19:21 An: qgis-user Betreff: Re: Fwd: [Qgis-user] QGIS "Near" Hi Joe, On Wed, Oct 20, 2010 at 5:06 PM, Joe Larson < joela...@gmail.com> wrote: Does the function 'snapWithContext' http://doc.qgis.org/head/classQgsVectorLayer.html#733b974dce13d587 e05cf3d4fc24f208 which "Snaps to segment or vertex within given tolerance." seem like what you're looking for? I came across it while trying to get Quantum Navigator working recently...seemed relative, but I'm no expert! This is similar to the mentioned solution with selecting by radius, or changing the tolerance of ID tool. Close, but no cigar. Since this is not very urgent, I've decided to continue pursuing that outlined solution Carson gave, and write a plugin i Python based on that. Since I actually never used Python before, it may take a while, but hey, I get to learn sth. new :-). I never got the word back from Carson, has he developed anything along these lines, but I have to presume he didn't... Anyone interested in joning me, or even earning some money, is still invited to jump on board. My GIS implementation project is well on the way, and it seems there'll even be some money involved :-). Zoran ~joe On Tue, Oct 19, 2010 at 9:55 AM, Andreas Neumann wrote: > Hi Zoran, > > I believe the infrastructure of what you want is already wihtin the > selection and identify tools in QGIS. Isn't this almost implemented in the > current identify tool? > > It sort of is, but not completely. Identify will ID all the features within certain radios (percentage of extent), but it will ID _all_ of the features within this radius. I only need the nearest, no matter how far away... Let us say it is, for simplicity, within current extent. > The current identify tool selects "near" or "close by" features within a > certain tolerance. This tolerance can be set in "Options" --> "Map tools" > "search radius". I believe it currently only effects the identify tool. Do > you want the same tolerance also be used for the click-selection tool? > > Look above. This could be useful, but it is not the functionality I'm currently looking after. > Are you also aware that in QGIS 1.6 there are new selection tools? > > * by click > * by rectangle > * by polygon > * by freehand > * by radius > > Yup, these are great, but they all select _multiple_ features within radius, rectangle, etc. > Maybe this also helps to address your needs? > > Of course you can combine it with previous selections by pressing the ctrl > key. > > BR, --- Zoran Jankovic ZIS-Izrada softvera i savjetovanje / ZIS - Software Development and Consulting http://www.zisis.hr M: 00 385 98 682 902 T: 00 385 44 683 374 A. Senoe 4 44320 Kutina Croatia ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user