I am trying to calculate the costpath from a location (polygon) to a point dataset using QGIS. I found two tools (r.cost.raster & accumulated cost (isotropic)), which both would work, if I would use only raster datasets. Unfortunatly one of my Datasets is a polygon so I can't use these tools. Any ideas how I could work around this problem?
closed as too broad by mgri, whyzar, tinlyx, Michael Stimson, nmtoken Jun 19 '17 at 7:27
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
You have to use PyQGIS for that, here is an example:
# define the point pt = QgsPoint(572470.29638,191838.143182) pt = QgsGeometry.fromPoint(pt) # get the active polygon layer = qgis.utils.iface.activeLayer() polygon = layer.getFeatures().next() geom = polygon.geometry() # do the business distanceToPolygon = QgsGeometry.distance(pt, geom) print distanceToPolygon