Skip to content

Commit 05e9394

Browse files
committed
Merge branch 'master' into 4.0.x
2 parents 9ec284b + 962cccb commit 05e9394

26 files changed

+618
-156
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
## [Unreleased]
44

5+
## [4.1.0] - 2021-03-03
6+
### Added
7+
- Added `UTMPoint` as a better way of handling UTM zones than the EPSG model does it
8+
- Improved conversion chaining for `CompoundPoint`s
9+
### Changed
10+
- moved `verticalOffsetAndSlope` method from `CompoundPoint` to `VerticalPoint`. This is technically a breaking change, but since the code is only 2 days old shouldn't affect anyone.
11+
512
## [4.0.1] - 2021-03-01
613
### Fixed
714
- Documentation issues

docs/builtin_units_angles.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Units of angle
22
==============
33

44
.. tip::
5-
All angle units have helper methods ``->asDegrees()``, ``->asRadians()``, ``->add()``, ``->substract()``,
5+
All angle units have helper methods ``->asDegrees()``, ``->asRadians()``, ``->add()``, ``->subtract()``,
66
``->multiply()`` and ``->divide()``
77

88
Degree

docs/builtin_units_lengths.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Units of length
22
===============
33

44
.. tip::
5-
All length units have helper methods ``->asMetres()``, ``->add()``, ``->substract()``,
5+
All length units have helper methods ``->asMetres()``, ``->add()``, ``->subtract()``,
66
``->multiply()`` and ``->divide()``
77

88
Metre

docs/builtin_units_scales.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Units of scale
22
==============
33

44
.. tip::
5-
All scale units have helper methods ``->asUnity()``, ``->add()``, ``->substract()``,
5+
All scale units have helper methods ``->asUnity()``, ``->add()``, ``->subtract()``,
66
``->multiply()`` and ``->divide()``
77

88
Unity

docs/builtin_units_times.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Units of time
22
=============
33

44
.. tip::
5-
All time units have helper methods ``->asYears()``, ``->add()``, ``->substract()``,
5+
All time units have helper methods ``->asYears()``, ``->add()``, ``->subtract()``,
66
``->multiply()`` and ``->divide()``
77

88
Year

docs/coordinate_conversions.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ Coordinate conversions
22
======================
33
PHPCoord can convert coordinates representing a point from one *Coordinate Reference System (CRS)* to another one. In
44
this simplest case this might just be converting units (e.g. feet to metres or vice versa), but in most cases involves
5-
running one or more complex algorithms involving a **lot** of trigonometry on the numbers.
5+
running one or more complex algorithms on the numbers.
66

7-
Most algorithms are not standalone, but require parameters to be work - for instance many require the origin point
7+
Most such algorithms are not standalone, but require parameters to work - for instance many require an origin point
88
to be specified and these points differ across mapping systems even when they utilise the same algorithm. Knowing both
9-
the algorithm(s) to be used and the parameters used to tune them is essential for high-accuracy conversions.
9+
the algorithm(s) to be used and the parameters used to tune them is essential to perform high-accuracy conversions.
1010

1111
.. note::
1212
If the Earth were actually the shape of an ellipsoid, algorithms could be devised so that conversions between systems
1313
could be performed with no absolutely no loss of accuracy - systems would in effect be mathematically equivalent.
1414

15-
Unfortunately the Earth isn't an ellipsoid and (pre-GPS) all coordinates were calculated by individual humans
15+
Unfortunately the Earth isn't an ellipsoid and coordinates are determined by individual humans
1616
operating on the Earth's actual, irregular surface using instruments subject to observation error. That means
1717
that conversions between CRSs are not just converting between mathematical ideals but often convert between
1818
*sets of observations*. When this happens it means that the conversions between the CRSs can only ever be
@@ -28,7 +28,7 @@ PHPCoord offers two models of operation for coordinate conversion:
2828
* The hard way in which you can directly utilise one of the many implemented algorithms along with the parameters of your
2929
choice to keep full control over the conversion
3030
* The easy way in which PHPCoord consults the built-in EPSG dataset for the relevant algorithm(s) to use and best
31-
parameters to use for your chosen conversion and executes them behind the scenes on your behalf. Recommended.
31+
parameters to use for your chosen conversion and executes them behind the scenes on your behalf.
3232

3333
.. toctree::
3434
:maxdepth: 1

docs/coordinate_conversions_easy.rst

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ coordinates in the target CRS.
1818

1919
Although PHPCoord has knowledge of thousands of different conversions, this does not cover many scenarios. For example
2020
there is no published direct conversion between a British National Grid reference and a UTM Grid reference. In these
21-
scenarios PHPCoord can "chain" conversions it does know about to achieve the desired result. For that scenario, it would
21+
scenarios PHPCoord can "chain" conversions it does know about to achieve the desired result, for example it would
2222
automatically calculate British National Grid -> OSGB36 -> WGS84 -> UTM. This ability to chain means conversion
23-
between almost any two CRSs is possible as long as they have a common linkage.
23+
between almost any two CRSs is possible as long as they have a common link.
2424

2525
.. code-block:: php
2626
@@ -29,7 +29,7 @@ between almost any two CRSs is possible as long as they have a common linkage.
2929
new Metre(69741),
3030
Projected::fromSRID(Projected::EPSG_OSGB_1936_BRITISH_NATIONAL_GRID)
3131
);
32-
$toCRS = Projected::fromSRID(Projected::EPSG_WGS_84_UTM_GRID_SYSTEM_NORTHERN_HEMISPHERE);
32+
$toCRS = Projected::fromSRID(Projected::EPSG_WGS_84_UTM_ZONE_31N);
3333
$to = $from->convert($toCRS);
3434
3535
.. note::
@@ -63,6 +63,45 @@ to ``true``.
6363

6464
In practice this should not affect you as a ``VerticalPoint`` will normally be used as part of a ``CompoundPoint``.
6565

66+
Universal Transverse Mercator (UTM)
67+
-----------------------------------
68+
PHPCoord has 3 different ways of handling UTM references (:ref:`see here for details<utm_points>`).
69+
70+
For conversions that *do not* involve a ``UTMPoint``, use the ``->convert()`` method as described above.
71+
72+
For conversions from a ``GeographicPoint`` to a ``UTMPoint``, call the ``->asUTMPoint()`` method.
73+
74+
.. code-block:: php
75+
76+
$from = GeographicPoint::create(
77+
new Degree(43.642567),
78+
new Degree(-79.387139),
79+
null,
80+
Geographic2D::fromSRID(Geographic2D::EPSG_WGS_84)
81+
);
82+
$to = $from->asUTMPoint();
83+
84+
.. note::
85+
You cannot directly convert to a ``UTMPoint`` from a different kind of ``ProjectedPoint`` or a ``GeocentricPoint``,
86+
you must convert to the relevant ``GeographicPoint`` first. This is because the projection parameters are calculated
87+
dynamically at runtime and are not available to take part in chain creation.
88+
89+
For conversions from a ``UTMPoint`` back to the associated ``GeographicPoint``, call the ``->asGeographicPoint()`` method.
90+
91+
.. code-block:: php
92+
93+
$from = new UTMPoint(
94+
new Metre(630084),
95+
new Metre(4833439),
96+
17,
97+
UTMPoint::HEMISPHERE_NORTH,
98+
Geographic2D::fromSRID(Geographic2D::EPSG_WGS_84)
99+
);
100+
$to = $from->asGeographicPoint();
101+
102+
The ``->convert()`` method *is* present on ``UTMPoint``\s and can be used as normal to convert to any desired CRS
103+
(including the base CRS).
104+
66105
.. rubric:: Footnotes
67106

68-
.. [#f1] There are over 36 million possible combinations of source and target CRS. They have not all been tested...
107+
.. [#f1] There are over 36 million possible combinations of source and target CRS. They haven't *all* been tested...

docs/coordinate_conversions_hard.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ They are listed in detail on the following pages.
66

77
.. tip::
88
The first parameter of every method is always a ``CoordinateReferenceSystem`` object representing the target
9-
CRS. For guidance on remaining parameters, please see a textbook, explaining those is far outside the
9+
CRS. For guidance on remaining parameters, please see a textbook as explaining them is far outside the
1010
scope of this documentation.
1111

1212
.. toctree::

docs/coordinate_conversions_hard_compound.rst

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,3 @@ Geographic2D with Height Offsets
1313
Angle $longitudeOffset,
1414
Length $geoidUndulation
1515
); // returns a new GeographicPoint
16-
17-
Vertical Offset and Slope
18-
-------------------------
19-
20-
.. code-block:: php
21-
22-
$point = CompoundPoint::create(...);
23-
$newPoint = $point->verticalOffset(
24-
Compound $to,
25-
Angle $ordinate1OfEvaluationPoint,
26-
Angle $ordinate2OfEvaluationPoint,
27-
Length $verticalOffset,
28-
Angle $inclinationInLatitude,
29-
Angle $inclinationInLongitude
30-
); // returns a new CompoundPoint

docs/coordinate_conversions_hard_vertical.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,19 @@ Vertical Offset
2121
Vertical $to,
2222
Length $verticalOffset
2323
); // returns a new VerticalPoint
24+
25+
Vertical Offset and Slope
26+
-------------------------
27+
28+
.. code-block:: php
29+
30+
$point = VerticalPoint::create(...);
31+
$newPoint = $point->verticalOffsetAndSlope(
32+
Vertical $to,
33+
Angle $ordinate1OfEvaluationPoint,
34+
Angle $ordinate2OfEvaluationPoint,
35+
Length $verticalOffset,
36+
Angle $inclinationInLatitude,
37+
Angle $inclinationInLongitude,
38+
GeographicPoint $horizontalPoint
39+
); // returns a new VerticalPoint

0 commit comments

Comments
 (0)