7.1. Lesson: Reproyectando y Transformando Datos¶
Hablemos sobre Sistemas de Referencia de Coordenadas (SRCs) de nuevo. Lo hemos visto brevemente antes, pero no hemos discutido su significado práctico.
El objetivo de esta lección: Reproyectar y transformar conjuntos de datos vectoriales.
7.1.1.
Follow Along: Proyecciones¶
El SRC en el que se encuentran todos los datos además del propio mapa en este momento se llama WGS84. Es un Sistema Geográfico de Coordenadas (SGC) para la representación de datos. Pero como veremos, hay un problema.
Save your current map
Then open the map of the world which you’ll find under
exercise_data/world/world.qgs
Zoom in to South Africa by using the Zoom In tool
Try setting a scale in the Scale field, which is in the Status Bar along the bottom of the screen. While over South Africa, set this value to 1:5 000 000 (one to five million).
Pan around the map while keeping an eye on the Scale field
Notice the scale changing? That’s because you’re moving away from the one point that you zoomed into at 1:5 000 000, which was at the center of your screen. All around that point, the scale is different.
Para entender por qué, piensa en el Globo Terráqueo. Tiene lineas discurriendo de Norte a Sur. Estas líneas están alejadas en el ecuador, pero se encuentran en los polos.
En un SGC, tú trabajas en esa esfera, pero tu pantalla es plana. Cuando intentas representar la esfera en una superficie plana, hay distorsiones, de forma similar a si cortaras una pelota de tenis e intentaras aplanarla. Lo que pasa en el mapa es que las líneas longitudinales se conservan a la misma distancia, incluso en los polos (donde se supone que se conectan). Esto significa que, cuando te alejas del ecuador en tu mapa, la escala de los objetos que tu ves se va agrandando. Lo que significa para nosotros es, prácticamente, ¡que no hay una escala constante en nuestro mapa!
Para solucionar esto, utilicemos en su lugar un Sistema de Coordenadas Proyectado (SCP). Un SCP «proyecta» o convierte los datos en una forma que permite a la escala cambiar y corregirse. Además, para mantener la escala constante, deberiamos reproyectar nuestros datos a usar un SCP.
7.1.2.
Follow Along: Reproyección «Al Vuelo»¶
By default, QGIS reprojects data «on the fly». What this means is that even if the data itself is in another CRS, QGIS can project it as if it were in a CRS of your choice.
You can change the CRS of the project by clicking on button
in the bottom right corner of QGIS.
In the dialog that appears, type the word
global
into the Filter field. One CRS (NSIDC EASE-Grid 2.0 Global, EPSG:6933) should appear in the list below.Click on the NSIDC EASE-Grid 2.0 Global to select it, then click OK.
Observa cómo cambia la forma de Sudáfrica. Todas las proyecciones funcionan cambiando las formas aparentes de los objetos de la Tierra.
Zoom in to a scale of 1:5 000 000 again, as before.
Desplázate sobre el mapa.
¡Observa cómo la escala permanece igual!
La transformación» al vuelo» también se usa para combinar conjuntos de datos que están en diferentes SRCs.
Add another vector layer to your map which has the data for South Africa only. You’ll find it as
exercise_data/world/RSA.shp
.Load it and a quick way to see what is its CRS is by hovering the mouse over the layer in the legend. It is
EPSG:3410
.
¿Qué observas?
The layer is visible even if it has a different CRS from the continents one.
7.1.3.
Follow Along: Guardando un Conjunto de Datos en Otro SRC¶
Sometimes you need to export an existing dataset in another CRS. As we will see in the next lesson, if you need to make some distance calculations on layer, it is always better to have the layer in a projected coordinate system.
Be aware that the “on the fly” reprojection is related to the project and not to single layers. This means that layers can have different CRS from the project even if you see them in the correct position.
But you can easily export the layer in another CRS.
Right-click on the buildings layer in the Layers panel
Select Save Vector Layer as… dialog.
in the menu that appears. You will be shown theClick on the Browse button next to the File name field
Navigate to
exercise_data/
and specify the name of the new layer as buildings_reprojected.shp.We must change the value of the CRS. Only the recent CRSs used will be shown in the drop down menu. Click on the
button next to the dropdown menu.
The CRS Selector dialog will now appear. In its Filter field, search for
34S
.Select WGS 84 / UTM zone 34S from the list
Leave the other options unchanged. The Save Vector Layer as… dialog now looks like this:
Click OK
You can now compare the old and new projections of the layer and see that they are in two different CRS but they are still overlapping.
7.1.4.
Follow Along: Creando Tu Propia Proyección¶
Hay muchos más proyecciones que las incluidas en QGIS por defecto. Además, también puedes crear tus propias proyecciones.
Start a new map
Load the
world/oceans.shp
datasetGo to
and you’ll see this dialog.An interesting projection to use is called
Van der Grinten I
. Enter its name in the Name field.Esta proyección representa la Tierra en un campo circular en lugar de una zona rectangular, como la mayoría de proyecciones hacen.
Add the following string in the Parameters field:
+proj=vandg +lon_0=0 +x_0=0 +y_0=0 +R_A +a=6371000 +b=6371000 +units=m +no_defs
Click OK
Choose your newly defined projection (search for its name in the Filter field)
Aplicando esta proyección, el mapa será reproyectado así:
7.1.5. In Conclusion¶
Proyecciones diferentes son útiles para diferentes propósitos. Eligiendo la proyección correcta, puedes asegurarte que los elementos de tu mapa se están representando de forma precisa.
7.1.6. Further Reading¶
Materials for the Advanced section of this lesson were taken from this article.
Further information on Coordinate Reference Systems is available here.
7.1.7. What’s Next?¶
En la siguiente lección aprenderás a analizar datos vectoriales utilizando varias herramientas de análisis vectorial de QGIS.