MrMufflon / Leaflet.Coordinates

Leaflet plugin to view mouse coordinates
http://mrmufflon.github.io/Leaflet.Coordinates/
Other
104 stars 55 forks source link

Degrees decimal minutes as return format? #9

Open gwacker opened 10 years ago

gwacker commented 10 years ago

New feature suggestion:

Instead of useDMS:false, what about passing in an array of one or more output formats. Multiple formats would stack in the order passed in.

{format: ['dms']} would be like useDMS:true currently returns {format: ['ddm']} would be a new format... most GPSs use this format and probably most human readable (if you're not a programmer) {format: ['dd']} would be like useDMS:false currently returns

{format: ['dms', 'ddm', 'dd']} would stack all three of them in the output container

degrees minutes seconds output Lat: 40° 26′ 46″ N, Lon: 79° 58′ 56″ W degrees decimal minutes output Lat: 40° 26.767′ N, Lon: 79° 58.933′ W decimal degrees output Lat: 40.446, Lon: -79.982

MrMufflon commented 10 years ago

You mean display them all at once? I don´t know if I like that, but the DDM format would definetly be useful.

gwacker commented 10 years ago

Well, an option to display more than one format depending on what is passed in with the format array. I guess my thought was it's not much extra work/code to offer the option to pass in or return more than one format.

While the vast majority would probably still pass in only a single format, I can see this combo being useful. L.control.coordinates({ format: ['ddm', 'dd'] }).addTo(map);

A new way to pass in formats would break backwards compatibility, but it also opens things up to offer a few more formats down the road like Universal Transverse Mercator (UTM) and military grid reference system (MGRS)

Thanks for the consideration.

s7726 commented 4 years ago

Easy enough to detect if it's passed as a value, or a list. Shouldn't break backwards compatibility.