Vector layer reprojection

Last time we showed how to give a coordinate system to a loaded vector layer. What if we want to convert the coordinates of objects from one system to another? We can use the spTransform tool from the sp library (the sp library is loaded along with rgdal).

Let’s load the layer into R:

Display information about the railroad layer:

The layer is in the system PUWG 1992. Let’s transform the coordinates of the objects into the geographic system WGS84 (EPSG:4326).

First, let’s write the layout parameters to the cs_wgs84 variable:

Korzystając z funkcji spTransform przeliczmy wszystkie współrzędne warstwy kolej do nowego układu:

With the function spTransform we transform all coordinates of the railroad layer into the new coordinate system:

Display the layer information:

The objects have been transformed to the new coordinate system.

Leave a Reply

Your email address will not be published.

Translate using Google Translate»
Social media & sharing icons powered by UltimatelySocial

Podoba Ci się nasza strona? Odwiedź nasz profil