Thursday 19 April 2018

qgis - Clipping vector layers with different CRS


I have two vector layers:



  1. provinces (Belge_Lambert_1972, EPSG:103300) - clip layer

  2. building (WGS 84/ Pseudo Mercator, EPSG:3857) - input layer



I would like to overlay them, however there is something wrong. I believe it had to do with the Coordinate Reference System.


When i work with the layer without conversion of the reference systems, the data does overlay exactly. I know that the buildings should lie within the provinces from the definition of the layer. However, when I want to clip the layers I get an notification:



Layers do not all use the same CRS. This can cause unexpected results. Do you want to continue?



enter image description here


On the other hand, when I do convert the WGS 84/ Pseudo Mercator, EPSG:3857 to Belge_Lambert_1972, EPSG:103300 CRS, the layers are not overlapping at all. Actually, I can find the layers by using "zoom to layers".


How can I clip these two layers correctly?



Answer




Eliot has right. You might perform a projection instead of reprojection.


Your data were created in differents CRS, that's mean that coordinates of your geometries are not the same but with OFP (on flight projection) you visualize your data as there were convert on the defined CRS in your projet. But to perform analyses or spatial algorithms, the geometries of your two differents dataset need to fit each other .
To do so you should use the Save As layer option (right click on the layer in layer panel).


If you use set layer CRS instead of converting, the coordinates of your geometry will not change. Than with Save as, coordinates are converted under the new CRS.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...