When do you need to add Custom CRS projection to add in QGIS? After all QGIS supports more than 2700 predefined CRS – Coordinates Reference system. Which is very common and is also installed in PostGIS database. But there are times when you receive a GIS data files in different CRS or projections or when somebody or your clients wants the GIS data files in a different CRS. At this time you may enquire to look into Custom CRS.
I got the same case, when one of my client was trying to convert a GML file to KML file. It would be a different topic to understand or find the CRS of GIS file. When my client asked for the problem they were facing while using the tool, I had jumped over to find the issue to solve it. As the file the user was trying to convert was GML file, which can also be opened in Text editor, I was able to easily figure out the projection the file is in. Which I found is very rarely used and it was not supported by the tool then. Finally we had converted the file from backend and was able to successfully resolve the clients problem.
Let me give you step by step procedure to make a file supports custom CRS and render it accordingly in QGIS.
Steps to Add Custom CRS projection in QGIS
1.) Open up QGIS. On the top Navbar of QGIS, select Settings option and click on Custom CRS or Custom Projection option. (In both version of QGIS 2.x or QGIS 3.x you will be getting this options for Custom CRS projection). This will open up a new Window in QGIS with different options.
2.) In the window, click on + or plus sign and give a name to the CRS. And under parameter option, put the values in proj4 definition of CRS.
Most of the time, you will be able to get the projection value in WKT format and not in proj4 format. While to add custom CRS QGIS supports proj4 format to be added.
For example here, in my case, I was know that the GML file is having the PCS_Lambert_Conformal_Conic projection. And for the same to support in QGIS, I wanted get to the proj4 value of PCS_Lambert_Conformal_Conic. So I was able to find out the link to get the wkt of PCS_Lambert_Conformal_Conic. Somehow I was not able to get the proj4 which this website support.
So I converted wkt to proj4 format of CRS with gdalsrsinfo open source tool of GDAL.
gdalsrsinfo -o proj4 example.prj
Once done save the changes. QGIS also provides a testing tool, where we can provide the WGS 84 coordinates and get the coordinates of newly added custom CRS projection.
3.) Now after adding the custom projection or custom CRS, you can find the option to change the CRS of the layer or file added. That is, right click on layer and click on Set layer CRS. Search and Select the custom CRS or projection Added.
This would make your file to work properly, as how you want it.Hope this tutorial helps you to Add Custom CRS or Custom Projection in QGIS, and render or display the file properly. If you found any issue while performing the steps please comment below.