Projected points ================ A projected point is one that has an *east-west* distance and a *north-south* distance. These are most often called *eastings* and *northings*, but sometimes *westings* and/or *southings* are used instead. Some coordinate systems eschew directional naming and use just *x* and *y* instead, the meaning of which varies. PHPCoord's input always uses the directional naming system. If you have coordinates ``(x,y,h)``, then you *may* need a 3D projected point, but you *probably* need a 2D ``ProjectedPoint`` plus a ``VerticalPoint``, and then to tie them together with a ``CompoundPoint``. Only if ``h`` represents ellipsoidal height should ``h`` be used as a third dimension when constructing a ``ProjectedPoint``. .. note:: Within the built-in PHPCoord systems, only ``Projected::EPSG_LUREF_LUXEMBOURG_TM_3D`` is a 3D system, all others are 2D. .. caution:: Do not confuse ``(x,y,h)`` with ``(x,y,z)``. ``(x,y,z)`` is used by Geocentric coordinate systems. A ``ProjectedPoint`` can be constructed by calling one of the ``ProjectedPoint::create*`` methods, which have the following signatures: .. code-block:: php public static function createFromEastingNorthing( Projected $crs, Length $easting, Length $northing, ?DateTimeInterface $epoch = null, ?Length $height = null ): ProjectedPoint public static function createFromWestingNorthing( Projected $crs, Length $westing, Length $northing, ?DateTimeInterface $epoch = null, ?Length $height = null ): ProjectedPoint public static function createFromWestingSouthing( Projected $crs, Length $westing, Length $southing, ?DateTimeInterface $epoch = null, ?Length $height = null ): ProjectedPoint Examples: .. code-block:: php getEasting(); // Length $northing = $point->getNorthing(); // Length $epoch = $point->getCoordinateEpoch(); // DateTimeImmutable|null $crs = $point->getCRS(); // Projected $asString = (string) $point; // '(530017, 180419)' British National Grid --------------------- .. sidebar:: GB grid references .. image:: images/osgb.png (also known as Ordnance Survey National Grid) In Great Britain, the convention is not to use as-is the easting and northing coordinates produced by the projection. The country is divided into sub-grids of 100km×100km which are given 2 letter codes, and then coordinates are given referenced to their position within the subgrid rather than the national origin. Thus, Nelson's Column ``(530017, 180419)`` would usually be referred to as ``TQ 30017 80419``. Exchanging numbers for letters in this way sounds complex, but having the grid letters aids greatly in finding the right map sheet when working with paper maps. Using the letters also clearly distinguishes between "pure" eastings/northings and the grid system. This has the benefit that it becomes permissible to truncate coordinates when full metre-level precision is not required, e.g. when trying to locate a building. For example, if just trying to locate Trafalger Square as a whole rather than specifically Nelson's statue, a coordinate like ``TQ 300 804`` could be given which is accurate to ~100m. This would not be possible to give purely numerically, as it could be confused with an actual full coordinate for a different point. A ``BritishNationalGridPoint`` is automatically created from ``ProjectedPoint::createFromEastingNorthing()`` if the relevant CRS is supplied - the examples above all actually create a ``BritishNationalGridPoint`` rather than a standard ``ProjectedPoint``. Alternatively, you can construct one directly. .. code-block:: php // from full eastings and northings public function __construct( Length $easting, Length $northing, ?DateTimeInterface $epoch = null ): BritishNationalGridPoint // from a grid reference public static function fromGridReference( string $reference, ?DateTimeInterface $epoch = null ): BritishNationalGridPoint Examples: .. code-block:: php asGridReference(10); // 'TQ3001780419' $asString = $point->asGridReference(6); // 'TQ300804' $asString = $point->asGridReferenceWithSpaces(10); // 'TQ 30017 80419' $asString = $point->asGridReferenceWithSpaces(6); // 'TQ 300 804' Irish Grid ---------- Ireland adopted a similar system to Britain that also uses grid letters. Each 100km×100km grid square in Ireland is identified by a single letter rather than by two, in other respects the system is near identical. A ``IrishGridPoint`` is automatically created from ``ProjectedPoint::createFromEastingNorthing()`` if the relevant CRS is supplied. Alternatively, you can construct one directly. .. code-block:: php // from full eastings and northings public function __construct( Length $easting, Length $northing, ?DateTimeInterface $epoch = null ): IrishGridPoint // from a grid reference public static function fromGridReference( string $reference, ?DateTimeInterface $epoch = null ): IrishGridPoint Examples: .. code-block:: php asGridReference(10); // 'O1590434671' $asString = $point->asGridReference(6); // 'O159346' $asString = $point->asGridReferenceWithSpaces(10); // 'O 15904 34671' $asString = $point->asGridReferenceWithSpaces(6); // 'O 159 346' Irish Transverse Mercator ------------------------- In 2001, Ireland introduced a replacement system for the Irish Grid system known as Irish Transverse Mercator (ITM). In ITM eastings and northings are always given in full. ITM does not use grid letters. Nonetheless, PHPCoord comes with a dedicated ``IrishTransverseMercatorPoint`` class. This class exists only to try and mitigate any confusion in advance between the two systems - a developer who was not aware of the older system, might accidentally try to use a ``IrishGridPoint`` thinking it was the right thing to do when they actually have coordinates in the ITM system. The class has no additional functionality over a standard ``ProjectedPoint``. .. code-block:: php // from full eastings and northings public function __construct( Length $easting, Length $northing, ?DateTimeInterface $epoch = null ): IrishTransverseMercatorPoint Examples: .. code-block:: php getEasting(); // Metre $northing = $point->getNorthing(); // Metre $zone = $point->getZone(); // int $hemisphere = $point->getHemisphere(); // UTMPoint::HEMISPHERE_NORTH|UTMPoint::HEMISPHERE_SOUTH $epoch = $point->getCoordinateEpoch(); // DateTimeImmutable|null $baseCRS = $point->getBaseCRS(); // Geographic $crs = $point->getCRS(); // Projected (synthesised at runtime, not one from the built-in EPSG set) $asString = (string) $point; // '33N 291789 5034599'