GRASS 7 tools used from QGIS produce a result in a projection differing from the input projection which might lead to inconsistences:

Example v.net.connect, input EPSG of both layers is 31468 (DHDN GK4):

enter image description here

Result is in EPSG:3397 (PD/83 GK4):

enter image description here

Same with v.clean.

The resulting network is located ~1.5m away from the original, which is of course unacceptable (blue: original network, red: result after v.clean rsp. v.net.connect):

enter image description here

Why this unauthorized change of coordinate system and how to force GRASS 7 tools executed from QGIS (2.18.16) to output results in the same CRS as the inputs?


Trying the same in QGIS 2.99.0-280 leads to the same change in CRS, but does not cause erroneous dislocation of the data:

enter image description here


I think it's good news that in 2.18.17 I did not observe the above mentioned dislocation.

Assume you are using GRASS 7 algorithms from either graphical modeler or with PyQGIS processing module you can do a reproject right after the GRASS 7 algorithm

in the graphical modeler:

enter image description here

enter image description here

in PyQGIS sth. like:

import processing
root = QgsProject.instance().layerTreeRoot()
input_layer = QgsMapLayerRegistry.instance().mapLayersByName('TheInputLayer')[0]
clean = processing.runalg('grass7:v.clean', network_layer, 0, 0.1, region, -1, 0.0001, None, None)
clean_repr = processing.runalg('qgis:reprojectlayer', clean['output'], 'EPSG:31468', None)
clean_repr_lyr = QgsVectorLayer(clean_repr['OUTPUT'], 'result_31468', 'ogr')

...where region is a grass region extent like described in the answer to Get results from using GRASS algorithms with the QGIS processing tool

In the layer properties you can see that the result is now in 'EPSG:31468'


EPSG:31468 and EPSG:3397 share the same projection parameters, but differ in the datum. The first has towgs84 parameters, while the second does not.

Your output is a shapefile, and the shapefile projection definition does not care about datum shifts nor EPSG codes. So QGIS has to guess, and selects the wrong one.

Try Set Layer CRS to get it back to the right one, or select a different file format that cares about shift parameters and EPSG codes, like spatialite.

Or do all your work in WGS84-based coordinate systems like ETRS89 UTM (what I prefer by now).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.