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?
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? Are you also aware that in QGIS 1.6 there are new selection tools? * by click * by rectangle * by polygon * by freehand * by radius Maybe this also helps to address your needs? Of course you can combine it with previous selections by pressing the ctrl key. Andreas On Tue, October 19, 2010 9:33 am, Zoran Jankovic wrote: > Sorry, I found out I sent this only to Carson, and not to the list, so I'm > forwarding the messagge to the list. Has anyone worked on a "Near" plugin, > or something similar? > > > ---------- Forwarded message ---------- > From: Zoran Jankovic <[email protected]> > Date: Sun, Oct 17, 2010 at 11:26 PM > Subject: Re: [Qgis-user] QGIS "Near" > To: [email protected] > > > Carson, > > Have you, by any chance, pursued this idea further? I would be very much > interested in a plugin that could determine the closest point feature, and > select it, from the selected layer, when clicked anywhere on the map. Or, > closest to the preselected feature. > > Example: > > I have a lot of points that represent hydrants. This layer is selected in > the list. I choose this hypothetical "Near" function from the menu, and > click anywhere on the map. The closest hydrant to where I clicked is > selected. > > Example 2: > > Same as previous, but I do not have to click, I can select an already > existing point and than have the nearest hydrant to this point selected. > > It is crucial that I do not want to create any new layers, define "to" and > "from" layers, etc. In the case of clicking on the map, there shouldn't be > any new point created... > > I would just need the nearest feature selected. > > Bonus: if the nearest feature could be a line, polyline or a polygon, not > just a point. > > I'm aware that all of the above is already possible to accomplish in > PostGIS, but this way it would be much simpler, and it would work > regardless > of data source: shp, postgis... as long as it is a vector layer in QGIS... > > I'm very close to implementing QGIS here in my hometown, and if I manage > to > actually earn any money from this, I would be more than happy to sponsor > the > development of such a plugin, for a reasonable price. The problem is I > need > the functionality now, and the money is yet to be earned :-(. > > Best regards, > > Zoran Jankovic > www.zisis.hr > > > > On Mon, May 31, 2010 at 1:11 PM, Carson Farmer > <[email protected]>wrote: > >> No plugin that I know of, but it could probably be done quite easily >> from the Python console, >> something to the tune of (untested!): >> >> layer = qgis.utils.iface.mapCanvas().layer(0) >> provider = layer.dataProvider() >> provider.select([]) >> feat = QgsFeature() >> index = QgsSpatialIndex() >> while provider.nextFeature(feat): >> index.insertFeature(feat) >> provider.select([]) >> while provider.nextFeature(feat): >> near = index.nearestNeighbour(feat.geometry().asPoint(),1) >> nearest = near[0] >> # now do something here with the two points... and output results >> as you like >> >> # Obviously you'd have a bit more work to do here to compute angles >> etc. but all this functionality is available via the QGIS API... >> # If I get a chance, I might try to add this to the fTools/Vector >> menu... >> >> Regards, >> >> Carson >> >> On 26 May 2010 22:13, whollycow <[email protected]> wrote: >> > Is anyone aware of a function equivalent to "Near" in ArcGIS? (see >> > >> http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=Near_(Analysis) >> > for reference) I have been searching all day and haven't come across >> > anything quite like it. It seems like such basic functionality I would >> be >> > surprised if someone hasn't already coded a solution. >> > ________________________________ >> > View this message in context: QGIS "Near" >> > Sent from the qgis-user mailing list archive at Nabble.com. >> > >> > _______________________________________________ >> > Qgis-user mailing list >> > [email protected] >> > http://lists.osgeo.org/mailman/listinfo/qgis-user >> > >> > >> >> >> >> -- >> Carson J. Q. Farmer >> ISSP Doctoral Fellow >> National Centre for Geocomputation >> National University of Ireland, Maynooth, >> http://www.carsonfarmer.com/ >> _______________________________________________ >> Qgis-user mailing list >> [email protected] >> http://lists.osgeo.org/mailman/listinfo/qgis-user >> > _______________________________________________ > Qgis-user mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/qgis-user > -- Andreas Neumann http://www.carto.net/neumann/ http://www.svgopen.org/ _______________________________________________ Qgis-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-user
