Is it possible to input gps coordinates in Degrees, Minutes and Seconds instead of decimal degrees?
Of maybe both notations (to select the output you prefer)?

Comments

VBN created an issue. See original summary.

christianadamski’s picture

Status: Active » Postponed (maintainer needs more info)

Hey VBN,

do you want a new way to INPUT geolocations (field widget) or to OUTPUT (field formatter) them. And how exactly would that have to look like? Writing either of these is probably not very hard, but I would need a very precise definition what needs to happen.

VBN’s picture

Well, input is the most important.
For this moment is only digital degrees:
In this format 123.456789, 78.945612.
But i want to let users input also degrees, minutes seconds notation like this:
123° 27' 24.4404" , 78° 56' 44.2032"

So both possible INPUT methods would be nice, but automatically detected.

This is calculated this way:

d = int(78.945612°) = 78°
m = int((78.945612° - 78°) × 60) = 56'
s = (78.945612° - 78° - 56'/60) × 3600 = 44.2032"
78.945612° = 78° 56' 44.2032"

OR reversed:

78° 56' 44.2032"
= 78° + 56'/60 + 44.2032"/3600
= 78.94561°

If you can output them in both notations, that would be a great bonus.
To use in a view, you could easily add another geolocation GPS field to display a different notation.

But again, the input method is the most important.

VBN’s picture

StatusFileSize
new32.88 KB
new36.56 KB

It would not really change the way it's used because actually, both inputs would display the same result.
Notation1

Notation2

christianadamski’s picture

Status: Postponed (maintainer needs more info) » Active

Ok. So:
- update GeolocationLatlngWidget.php to accept GPS format as well

Either
- add GPS formatter for output
- add GPS views field

or
- Add LatLngFormatter option to display GPS instead
- Add GeolocationField views field handler option to display GPS instead

Update/Add
- GeolocationFieldTest
- GeolocationItem

accordingly.

christianadamski’s picture

Status: Active » Needs review
StatusFileSize
new6.85 KB

Here's an initial version.
- It allows adding values in sexagesimal notation. Essentially 2 digits followed by "°" and optionally the rest.
- The sexagesimal notation will be shown in the widget description as well.
- added a field formatter displaying the sexagesimal notation
- views can use that formatter in the field display

Missing:
- a test
- testing by users

VBN’s picture

I'll go testing this for you, give me a few days.

christianadamski’s picture

StatusFileSize
new9.01 KB

And here is the same patch again with a test added.
Test checks for correct input and transformation both ways. The formatter is not tested, but I think that's fine, as it is based on the former. Should we need to test that as well, it's pretty easy.

christianadamski’s picture

Status: Needs review » Fixed

Let's see what the general audience thinks. Pushed.

derjochenmeyer’s picture

great! :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

VBN’s picture

Working like a charm in 8.x-1.x-dev!
What a great feature