I have a csv list of points with their reference in UTM (X,Y) format: 33411590,4225441;5657743,8981463;
As you can see, the first two digits of the X column are the zone number. When importing these data into QGIS (Import Text file as Layer), QGIS asks for a CRS (EPSG:32633 would be the choice) and takes the content of the X column as the X value, including the first two digits. Thereby, it places my point 33.000km too far east.
Is there any solution to change this behavior (ignoring the digits or even extracting their real information)? Or do I need to "cut" between Zone number and X value by myself, before feeding the dataset to QGIS?
Answer
I finally decided to solve this issue by saving the .csv as a new .geojson layer. In this layer, i can modify the geometry in order to cut away the unnecessary digits using modulo division:
def recalc_utm_geometry(layer):
iter = layer.getFeatures()
geometry_map={}
for feature in iter:
geom = feature.geometry().asPoint()
x = geom[0]
y = geom[1]
x = x % 1000000 # cut first 2 digits
geometry_map[feature.id()]=QgsGeometry.fromPoint(QgsPoint(x, y))
layer.dataProvider().changeGeometryValues(geometry_map)
No comments:
Post a Comment