-5

How find current utm zone from lon lat position (from mapcenter for example) ?

I need to determine which utm zone currently is from my position.

MSS
  • 3,520
  • 24
  • 29

1 Answers1

3
function getUtmZoneFromPosition(lon,lat) {
  return (Math.floor((lon + 180) / 6) % 60) + 1;
}

and in ol3 use function this way

function getCurrentUtmZone() {
    var position = ol.proj.transform(mapObj.getView().getCenter(), mapObj.getView().getProjection(), "EPSG:4326");
    return getUtmZoneFromPosition(position[0]);
}

var currentZone=getCurrentUtmZone();

Thanks to Determining UTM zone (to convert) from longitude/latitude

Community
  • 1
  • 1
MSS
  • 3,520
  • 24
  • 29