Usage

Target group: Integrators, Developers

General

After installation you can use the coordinate converter view helper in every Fluid template. The namespace is set to cc, the basic usage:

<cc:coordinateConverter latitude="49.487113" longitude="8.466284"/>
Copied!

The output is:

N 49.48711°, E 8.46628°
Copied!

The view helper arguments

The following arguments are available:

latitude
Type
float
Required

true

Possible values
+90.0 to -90.0

The latitude: a positive value is north, a negative value is south.

longitude
Type
float
Required

true

Possible values
+180.0 to -180.0

The longitude: a positive value is east, a negative value is west.

outputFormat
Type
string
Possible values
degree, degreeMinutes, degreeMinutesSeconds, UTM
Default
degree

The output format of the coordinates.

Example: Degree/minutes notation

<cc:coordinateConverter
   latitude="49.487111"
   longitude="8.466278"
   outputFormat="degreeMinutes"
/>
Copied!

The output is:

N 49° 29.22666', E 8° 27.97668'
Copied!

Example: Degree/minutes/seconds notation

<cc:coordinateConverter
   latitude="49.487111"
   longitude="8.466278"
   outputFormat="degreeMinutesSeconds"
/>
Copied!

The result is:

N 49° 29' 13.59960", E 8° 27' 58.60080"
Copied!

Example: UTM (Universal Transverse Mercator) notation

<cc:coordinateConverter
   latitude="49.487111"
   longitude="8.466278"
   outputFormat="UTM"
/>
Copied!

The result is:

32U 461344 5481745
Copied!
cardinalPoints
Type
string
Default
N|S|E|W

Results for the cardinal points, separated by |. The argument has no effect in output format UTM.

Example: Use full cardinal point name

<cc:coordinateConverter
   latitude="49.487111"
   longitude="8.466278"
   cardinalPoints="North|South|East|West"
/>
Copied!

The result is:

North 49.48711° / East 8.46628°
Copied!

Example: Use German abbreviations

<cc:coordinateConverter
   latitude="49.487111"
   longitude="8.466278"
   cardinalPoints="N|S|O|W"
/>
Copied!

The result is:

N 49.48711° / O 8.46628°
Copied!
cardinalPointsPosition
Type
string
Possible values
before, after
Default
before

Position for the cardinal points. The argument has no effect in output format UTM.

Example: Move cardinal point position to the end

<cc:coordinateConverter
   latitude="49.487111"
   longitude="8.466278"
   cardinalPointsPosition="after"
/>
Copied!

The result is:

49.48711° N, 8.46628° E
Copied!
numberOfDecimals
Type
int
Possible values
>= 0
Default
5

Number of decimals for the result. The argument has no effect in output format UTM.

Example: Show three decimals

<cc:coordinateConverter
   latitude="49.487111"
   longitude="8.466278"
   numberOfDecimals="3"
/>
Copied!

The result is:

N 49.487°, E 8.466°
Copied!
removeTrailingZeros
Type
bool
Default
0

Set to 1 to remove trailing zeros in a coordinate. The argument has no effect in output format UTM.

New in version TYPO3 v13.3

The boolean variables {true} and {false} can also be used instead of 0 and 1.

Example: Show trailing zeros (the default)

<cc:coordinateConverter
   latitude="49.48710"
   longitude="8.46600"
   removeTrailingZeros="1"
/>
Copied!

The result is:

N 49.4871°, E 008.466°
Copied!
delimiter
Type
string
Default
,

The delimiter between latitude and longitude. The argument has no effect in output format UTM.

Example:

<cc:coordinateConverter
   latitude="49.487111"
   longitude="8.466278"
   delimiter=" / "
/>
Copied!

The result is:

N 49.48711° / E 8.46628°
Copied!

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:

<html
   xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
   xmlns:cc="http://typo3.org/ns/Brotkrueml/Coordconverter/ViewHelpers"
   cc:schemaLocation="https://brotkrueml.dev/schemas/byt_coordconverter-3.0.0.xsd"
   data-namespace-typo3-fluid="true"
>
   ...
</html>
Copied!

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/.