` `
QGIS allows users to define a global and project-wide CRS (coordinate reference system) for layers without a pre-defined CRS. It also allows the user to define custom coordinate reference systems and supports on-the-fly (OTF) projection of vector and raster layers. All of these features allow the user to display layers with different CRSs and have them overlay properly.
QGIS has support for approximately 2,700 known CRSs. Definitions for each CRS are stored in a SQLite database that is installed with QGIS. Normally, you do not need to manipulate the database directly. In fact, doing so may cause projection support to fail. Custom CRSs are stored in a user database. See section Custom Coordinate Reference System for information on managing your custom coordinate reference systems.
The CRSs available in QGIS are based on those defined by the European Petroleum Search Group (EPSG) and the Institut Geographique National de France (IGNF) and are largely abstracted from the spatial reference tables used in GDAL. EPSG identifiers are present in the database and can be used to specify a CRS in QGIS.
In order to use OTF projection, either your data must contain information about its coordinate reference system or you will need to define a global, layer or project-wide CRS. For PostGIS layers, QGIS uses the spatial reference identifier that was specified when the layer was created. For data supported by OGR, QGIS relies on the presence of a recognized means of specifying the CRS. In the case of shapefiles, this means a file containing the well-known text (WKT) specification of the CRS. This projection file has the same base name as the shapefile and a .prj extension. For example, a shapefile named alaska.shp would have a corresponding projection file named alaska.prj.
Whenever you select a new CRS, the layer units will automatically be changed in the General tab of the Project Properties dialog under the Project (or Settings) menu.
QGIS starts each new project using the global default projection. The global default CRS is EPSG:4326 - WGS 84 (proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs), and it comes predefined in QGIS. This default can be changed via the Select CRS button in the first section, which is used to define the default coordinate reference system for new projects, as shown in figure_projection_options. This choice will be saved for use in subsequent QGIS sessions.
When you use layers that do not have a CRS, you need to define how QGIS responds to these layers. This can be done globally or project-wide in the CRS tab under Settings ‣ Options.
The options shown in figure_projection_options are:
If you want to define the coordinate reference system for a certain layer without CRS information, you can also do that in the General tab of the raster and vector properties dialog (see General Properties for rasters and General Properties for vectors). If your layer already has a CRS defined, it will be displayed as shown in General tab in vector layers properties dialog.
Tip
CRS in the Layers Panel
Right-clicking on a layer in the Layers Panel (section Layers Panel) provides two CRS shortcuts. Set layer CRS takes you directly to the Coordinate Reference System Selector dialog (see figure_projection_project). Set project CRS from Layer redefines the project CRS using the layer’s CRS.
QGIS supports on the fly CRS transformation for both raster and vector data. However, OTF is not activated by default. When OTF is off, each layer is drawn using the coordinates as read from the data source. When OTF is on, each layer’s coordinates are transformed to the CRS of the project.
There are three ways to enable On The Fly CRS Transformation:
If you have already loaded a layer and you want to enable OTF reprojection, the best practice is to open the CRS tab of the Project Properties dialog, activate the Enable ‘on the fly’ CRS transformation checkbox, and select a CRS. The CRS status icon will no longer be greyed out, and all layers will be OTF projected to the CRS shown next to the icon.
This dialog helps you assign a Coordinate Reference System to a project or a layer, provided a set of projection databases. Items in the dialog are:
Tip
Looking for a layer CRS? Use the CRS selector.
Sometimes, you receive a layer and you don’t know its projection. Assuming that you have another layer with a valid crs that should overlaps with it, enable the OTF reprojection and, in the General tab of the Layer properties dialog, use the Coordinate Reference System selector to assign a projection. Your layer position is then moved accordingly. You may have to do some trial and error in order to find the right position, hence its original CRS.
Catatan
When operating across layers, for example, computing intersections between two layers, it is important that both layers have the same CRS. To change the projection of an existing layer, it is insufficient to simply change the CRS in that layer’s properties. Instead you must save the layer as a new layer, and choose the desired CRS for the new layer.
If QGIS does not provide the coordinate reference system you need, you can define a custom CRS. To define a CRS, select Custom CRS... from the Settings menu. Custom CRSs are stored in your QGIS user database. In addition to your custom CRSs, this database also contains your spatial bookmarks and other custom data.
Defining a custom CRS in QGIS requires a good understanding of the PROJ.4 projection library. To begin, refer to “Cartographic Projection Procedures for the UNIX Environment - A User’s Manual” by Gerald I. Evenden, U.S. Geological Survey Open-File Report 90-284, 1990 (available at ftp://ftp.remotesensing.org/proj/OF90-284.pdf).
This manual describes the use of the proj.4 and related command line utilities. The cartographic parameters used with proj.4 are described in the user manual and are the same as those used by QGIS.
The Custom Coordinate Reference System Definition dialog requires only two parameters to define a user CRS:
To create a new CRS, click the Add new CRS button and enter a descriptive name and the CRS parameters.
Note that the Parameters must begin with a +proj= block, to represent the new coordinate reference system.
You can test your CRS parameters to see if they give sane results. To do this, enter known WGS 84 latitude and longitude values in North and East fields, respectively. Click on [Calculate], and compare the results with the known values in your coordinate reference system.
OTF depends on being able to transform data into a ‘default CRS’, and QGIS uses WGS84. For some CRS there are a number of transforms available. QGIS allows you to define the transformation used otherwise QGIS uses a default transformation.
In the CRS tab under Settings ‣ Options you can:
QGIS asks which transformation to use by opening a dialogue box displaying PROJ.4 text describing the source and destination transforms. Further information may be found by hovering over a transform. User defaults can be saved by selecting Remember selection.