I have been working in a data set that uses EPSG:25832 - its coordinate system means points are defined as large numbers - an example coordinate in Denmark would be X: 547250 Y 6260848. When I use these large coordinates in my code, QGIS seems to get upset, and renders the line inconsistently (it dissapears at most zoom levels, or if the camera is in certain places). For an example of what I mean I will provide a couple screenshots.
The code I am using is as follows:
vl = QgsVectorLayer("MultiLineString", "temporary_points1", "memory")
pr = vl.dataProvider()
vl.startEditing()
vl.updateFields()
fet = QgsFeature()
fet.setGeometry(QgsGeometry.fromPolylineXY([QgsPointXY(1, 1), QgsPointXY(546750,
6260849)]))
pr.addFeatures([fet])
vl.commitChanges()
vl.updateExtents()
QgsProject.instance().addMapLayer(vl)
Here you can see I have added two lines both starting from the coordinate 1,1. One goes to 20,20, and the other to the point in Denmark I mentioned before.
Now here is a picture with the camera zoomed out slightly and nothing else changed The line going to the large coordinate dissapeared
QGIS Version is 3.20.1-Odense - the latest release as of the question being asked
Has anyone else encountered this and is there a way to fix this?