GIScience / orstools-qgis-plugin

Plugin for QGIS with a set of tools to use openrouteservice API´s, based on openstreetmap
https://plugins.qgis.org/plugins/ORStools/
MIT License
92 stars 31 forks source link

Add feature id of the input layer to the resulting isochron feature #60

Closed kcrkor closed 5 years ago

kcrkor commented 6 years ago

Leverage the ability to return a unique id from the API for every unique request. This should address #52 by allowing the data to be joined on. On point selections, that have no inherent feature id, this defaults to -1

noerw commented 6 years ago

This could be generalized to pass an arbitrary attribute of the input feature, similar to QGIS' built in "Join by Location" or "Nearest Neighbour" (or maybe it was "Distance to nearest Hub"?)

nilsnolde commented 6 years ago

Thanks for taking the time! Isn't the .id() method always returning a feature ID? I figured it's an internal way of QGIS to identify features in a layer and is assigned automatically a QgsFeatureId. I'm not entirely sure about this. If what I said is true though, then I'm fine with this PR. IMO no need for user-selectable arbitrary attributes to use for a join. If it's not true, pls find an attribute that is always defined and feature unique.

kcrkor commented 6 years ago

@nilsnolde I used the .id() method, because it seems to be unique and inernal. With this it should be possible to join attributes in the same QGIS session, but I am no sure how it works after QGIS is restarted. I know that sorting the layer CSV file outside of QGIS3 changes the feature ids. I think this is good enough for now, but attributes are more robust.

@noerw The user selectable attribute can be easily based on the same code, but maybe this should be a separate PR?