Not a Git master yet, but here is my GitHub, where I will be posting my generally hacky and work in progress QGIS tools.

Currently working on my Near Matrix tool. Near has a long and sordid history in GIS as being the trolliest tool to paywall in Esri's ArcGIS. (although Erase can give it a run for its money sometimes).

Near, for reference, merely takes a set of geometries and compares it to another set of geometries (I'll go into more detail on other posts) finding the shortest distance between them.

QGIS has a couple of built in routes one can go down on this path, one of which is the "Nearest Neighbor Analysis", which does exactly this - but only for points, not lines or polygons, which limits its helpfulness.

Another route would be to use its GRASS module plug ins, one of which is v.distance. These are excellent tools, but you really need to pay attention to the input and outputs. They tend to be a bit "clunky" from my experience.

Instead, I'm building my own, which does what I need, as well as something extra that none of these tools does in a manner I appreciate - visually generate the line between the two geometries in question.

I wouldn't be supervised if QGIS has this natively soon (after all, all I am doing is using the underlying methods the main developers have exposed) but until its available in LTS I'll keep using this one.

Some things still left to do:
+ Better handle geographic coordinates (if these come in, the distances will be functionally useless, better either use some insane math or error out to the user)
+ Better handle NULL geometries (these are not going to play well with anything)
+ Create another field and dump the unit in them. (Experience with GIS tells me that a free floating "distance" double field will eventually be sent to someone with no idea if it is in feet or meters)
+ Create some fancy pants SVG icon for it, so I can get away with not useing the default.
+ Actually learn Git so I'm not constantly deleting / reuploading to the web interface


A couple of other notes -
+ Its atrocious to not handle the case that both comparison sets are the same - in which case one can go from n ^ 2 to n / 2, where n is the number of geometries to compare.

+ Warn. Warn about many, many things. Its not that its "wrong", just that the user (which might well be me, doesn't have a clue what they are actually doing)

+ Find some way of avoiding loading everything in memory. This is an underlying QGIS issue... it seems that opening up an .getFeatures() method corrupts another that is still open before.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.