Coordinate Converter ==================== |TYPO3| |TYPO3| |Build Status| |Latest Stable Version| This is a TYPO3 extension for converting geospacial coordinates from one format into another via a Fluid view helper. Requirements ------------ The extension in version 2.0 works with TYPO3 8 LTS and TYPO3 9 LTS. Use version 1.0.5 for TYPO3 7 LTS from the TYPO3 Extension Repository. Installation ------------ Installation via Composer ~~~~~~~~~~~~~~~~~~~~~~~~~ The recommended way to install this extension is by using `Composer `__. In your Composer based TYPO3 project root, just do :: composer require brotkrueml/coordconverter Installation as extension from TYPO3 Extension Repository (TER) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Download and install the extension with the extension manager module. Usage ----- General ~~~~~~~ After installation you can use it in every Fluid template. The namespace is set to ``cc``, the basic usage: :: Overview of the possible parameters: +-----------+------------------------+------+------------------------+ | Parameter | Description | Defa | Possible values | | | | ult | | | | | valu | | | | | e | | +===========+========================+======+========================+ | latitude | Latitude (required) | | +90.0 to -90.0 | +-----------+------------------------+------+------------------------+ | longitude | Longitude (required) | | +180.0 to -180.0 | +-----------+------------------------+------+------------------------+ | outputFor | The output format of | degr | degree, degreeMinutes, | | mat | the coordinates | ee | degreeMinutesSeconds, | | | | | UTM | +-----------+------------------------+------+------------------------+ | cardinalP | Results for the | N|S| | | | oints | cardinal points, | E|W | | | | separated by \| | | | +-----------+------------------------+------+------------------------+ | cardinalP | Position for the | befo | before, after | | ointsPosi | cardinal points | re | | | tion | | | | +-----------+------------------------+------+------------------------+ | numberOfD | Number of decimals for | 5 | 0- | | ecimals | the result | | | +-----------+------------------------+------+------------------------+ | removeTra | Set to true, if | fals | false, true, 0, 1 | | ilingZero | trailing zeros should | e | | | s | be removed | | | +-----------+------------------------+------+------------------------+ | delimiter | The delimiter between | , | | | | latitude and longitude | | | +-----------+------------------------+------+------------------------+ Output formats ~~~~~~~~~~~~~~ Degree notation with decimals ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: The output is: ``N 49.48711°, E 8.46628°`` **Notice:** The values for the latitude variable are number-only and range from +90.0 to -90.0, the positives values are north, the negative values are south. The values for the longitude variable range from +180.0 to -180.0, the positives values are east, the negative values are west. This input format is ideal to store in databases. The next example is identical, the output format parameter defaults to “degree”: :: Degree/minutes notation ^^^^^^^^^^^^^^^^^^^^^^^ To convert the coordinate pair into the degree/minutes format just add the output format parameter to the view helper: :: Now you get the result: ``N 49° 29.22666', E 8° 27.97668'`` Degree/minutes/seconds notation ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If you want to output the coordinate pair in minutes and seconds just use this syntax: :: The result is: ``N 49° 29' 13.59960", E 8° 27' 58.60080"`` UTM notation ^^^^^^^^^^^^ You can also convert the latitude/longitude coordinates to the UTM (Universal Transverse Mercator) notation: :: The result is: ``32U 461344 5481745`` Number of decimals ~~~~~~~~~~~~~~~~~~ The default number of decimals to show in the coordinates is set to 5. If you want to change the just use the numberOfDecimals parameter: :: The output is: ``N 49.4871°, E 8.4663°`` The parameter has no effect in output format “UTM notation”. Remove trailing zeros ~~~~~~~~~~~~~~~~~~~~~ Sometimes the coordinates look nicer when the trailing zeros are stripped. Just use the ``removeTrailingZeros`` parameter: :: The output is: ``N 49.4871°, E 8.466°`` This parameter has no effect in output format “UTM notation”. Delimiter ~~~~~~~~~ The default delimiter between the two coordinates is the comma with a white space. You can change it: :: You get the result: ``N 49.48711° / E 8.46628°`` The parameter has no effect in output format “UTM notation”. Cardinal points ~~~~~~~~~~~~~~~ You don’t like the abbreviations N, S, E, W? You can change it: :: Now you get: ``North 49.48711° / East 8.46628°`` Or you like to use the german version? :: This outputs: ``N 49.48711° / O 8.46628°`` The parameter has no effect in output format “UTM notation”. Cardinal points position ~~~~~~~~~~~~~~~~~~~~~~~~ You can choose, at which position to show the cardinal point, before or after the coordinate: :: Now you get the cardinal point after each coordinate: ``49.48711° N, 8.46628° E`` The parameter has no effect in output format “UTM notation”. Using the XML Schema (XSD) for Validation in your Template ---------------------------------------------------------- It is possible to assist your code editor on suggesting the tag name and the possible attributes. Just add the ``cc`` namespace to the root of your Fluid template: :: The relevant part is the namespace declaration (``xmlns:cc="http://typo3.org/ns/Brotkrueml/Coordconverter/ViewHelpers"``). The content of the ``cc:schemaLocation`` attribute points to the recent XSD definition. You can also import the XSD file into your favorite IDE, it is shipped with the extension. You can find the file in the folder ``Resources/Private/Schemas/``. Upgrading from version 1.0 to version 2.0 ----------------------------------------- Version 1.0 is available for TYPO3 7 LTS, version 2.0 works only for TYPO3 8 LTS und TYPO3 9 LTS. The following breaking changes were made: - The declaration of the ``cc`` namespace in the Fluid template to use the view helper is not needed anymore as it is bound to the extension. - The namespace of the PHP classes changed to ``Brotkrueml\BytCoordconverter\``. This shouldn’t harm you as the manual declaration of the Fluid namespace is not needed anymore. .. |TYPO3| image:: https://img.shields.io/badge/TYPO3-8%20LTS-orange.svg :target: https://typo3.org/ .. |TYPO3| image:: https://img.shields.io/badge/TYPO3-9%20LTS-orange.svg :target: https://typo3.org/ .. |Build Status| image:: https://travis-ci.org/brotkrueml/byt_coordconverter.svg?branch=master :target: https://travis-ci.org/brotkrueml/byt_coordconverter .. |Latest Stable Version| image:: https://poser.pugx.org/brotkrueml/coordconverter/v/stable :target: https://packagist.org/packages/brotkrueml/coordconverter