3

I've ran into a problem, where if I draw two parallel lines, enable Advanced Digitization and start a perpendicular line from one line to the other with Snapping enabled, when I try snap to the intersection, the perpendicular line moves up or down with an offset.

It snaps fine if digitization is not enabled, or if I want to snap on any other location, however as soon as my mouse gets to the expected intersection point, the target shifts.

enter image description here

Edit 1: I found another person having a similar issue here

4

"If the Earth were flat, we would not have these problems."


When digitizing in QGIS we must keep in mind two external sources of error, to our own digitalization work:

The first is that we must remember that we are digitizing on some flat projection of a curved surface. The second is that the QGIS digitization tools must perform some rounding in the coordinates, and that rounding does not favor us. Our task is to try to minimize them.


When projecting a curved surface to a plane, we must inevitably deform it.
Some projective systems resolve some kind of deformation, be it at angles, distances or areas, but none can solve more than one type.
In fact, some do not solve any of the three types. Such is the case of the two most used systems: EPSG:3857 and EPSG:4326. Both are useful for something, but that something is not precisely the geometric representation that your work requires.

EPSG:3857 is a spherical Mercator projection applied on an ellipsoidal datum, so it loses a little the main characteristic of Mercator projections, that of being comformal. In addition, distances acquire a noticeable deformation insofar as they move away from the equator.

EPSG:4326 is an equirectangular projection of geodetic coordinates, that is, it directly treats latitudes and longitudes as if they were flat coordinates. Which produces an impressive deformation in every way.


On the other hand, what happens if you want to digitize in QGIS when the project is being rendered in EPSG:4326?
The Advanced Digitizing tool says it can't work in that coordinate system.
It makes perfect sense. But what if you want to digitize an EPSG:4326 layer with the project in EPSG:3857?
The tool allows it, but inevitably it must transform the coordinates of the objects to perform the slope calculations (to draw a parallel or a perpendicular).
And what happens if you round to 6 decimal places? It turns out that in geographical coordinates a rounding to 6 decimal places may imply a 10cm imprecision in the equator.


So, now yes, what is the solution?

You must create a custom Coordinate Reference System that is a comformal projection, but that deforms the least possible distances in your work area. You must work in vector layers on that system, and have the QGIS (canvas) project rendered to that system.

I assume that it is understood that a conformal projection system is necessary if there are angular restrictions, such as parallelism and perpendicularity. And the canvas must be rendered on the same system because the advanced digitizing tool takes the coordinates there to perform the calculations.

In this way, you minimize both sources of error. And I assure you that you minimize them in a considerable amount.


Suppose your work area is moderately centered at the point of longitude -96,767 degrees and latitude 32,914 degrees.
Then, the proj chain for your coordinate system can take this form:

+proj=tmerc +lon_0=-96.767 +lat_0=32.914 +k=1 +x_0=1000 +y_0=2000 +datum=WGS84 +units=m +no_defs

This is a Transverse Mercator projection (https://proj.org/operations/projections/tmerc.html), of the WGS84 datum, tangential, focused on your work area. The false easting 1000 and false northing 2000 is a topographic custom, in order not to work in negative coordinates, and to differentiate eastings from northings by their number, as long as we work within a radius of less than one kilometer. It is conformal, and will not deform your distances a lot.

1

There I created the system in QGIS, which took the USER:100150 number in my internal database.

This is what happened with parallel and perpendicular drawn lines in an EPSG:4326 layer having the project in EPSG:3857:

2

And this is what happened with parallel and perpendicular drawn lines in an USER:100150 layer having the project in USER:100150:

3


Once the digitizing is finished, export the vector layers to the system you need. And always try not to reproject the raster layers, let QGIS reproject them on the fly.

2
  • Fabulous! I will mark this as the answer as soon as I get my account sorted out.
    – demir
    Oct 26 '19 at 6:30
  • I'm glad if you find it useful! Digitalization errors are common and are not usually given the appropriate treatment. Avoid the artifacts, but do not worry if objects lose their original shape when converted to WGS84, it is the most logical thing to happen! Oct 26 '19 at 10:17

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.