blob: 89ac2172f18ed7ce74ffbb80af81389c9c7231b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
.. _quickstart:
================================================================================
Quick start
================================================================================
Coordinate transformations are defined by, what in PROJ terminology is
known as, "proj-strings". A proj-string describes any transformation regardless of
how simple or complicated it might be. The simplest case is projection of geodetic
coordinates. This section focuses on the simpler cases and introduces the basic
anatomy of the proj-string. The complex cases are discussed in
:doc:`transformation`.
A proj-strings holds the parameters of a given coordinate transformation, e.g.
::
+proj=merc +lat_ts=56.5 +ellps=GRS80
I.e. a proj-string consists of a projection specifier, ``+proj``, a number of
parameters that applies to the projection and, if needed, a description of a
datum shift. In the example above geodetic coordinates are transformed to
projected space with the :doc:`Mercator projection<../operations/projections/merc>` with
the latitude of true scale at 56.5 degrees north on the GRS80 ellipsoid. Every
projection in PROJ is identified by a shorthand such as ``merc`` in the above
example.
By using the above projection definition as parameters for the command line
utility ``proj`` we can convert the geodetic coordinates to projected space:
::
$ proj +proj=merc +lat_ts=56.5 +ellps=GRS80
If called as above ``proj`` will be in interactive mode, letting you type the
input data manually and getting a response presented on screen. ``proj``
works as any UNIX filter though, which means that you can also pipe data to
the utility, for instance by using the ``echo`` command:
::
$ echo 55.2 12.2 | proj +proj=merc +lat_ts=56.5 +ellps=GRS80
3399483.80 752085.60
PROJ also comes bundled with the ``cs2cs`` utility which is used to transform
from one coordinate reference system to another. Say we want to convert
the above Mercator coordinates to UTM, we can do that with ``cs2cs``:
::
$ echo 3399483.80 752085.60 | cs2cs +proj=merc +lat_ts=56.5 +ellps=GRS80 +to +proj=utm +zone=32
6103992.36 1924052.47 0.00
Notice the ``+to`` parameter that separates the source and destination
projection definitions.
If you happen to know the EPSG identifiers for the two coordinates reference
systems you are transforming between you can use those with ``cs2cs``:
::
$ echo 56 12 | cs2cs +init=epsg:4326 +to +init=epsg:25832
231950.54 1920310.71 0.00
In the above example we transform geodetic coordinates in the WGS84 reference
frame to UTM zone 32N coordinates in the ETRS89 reference frame.
UTM coordinates
|