Select to view content in your preferred language

Convert map extent to UTM

2477
11
07-27-2018 09:58 AM
rajujee
Emerging Contributor

I  have a widget that calculate map extent or lat/long.

I need to convert these values to UTM (Mercator). Could you please help. I have included my code below.

 

 

define([

    'dojo/_base/declare',

    'dojo/_base/lang',

    'jimu/BaseWidget',

    'jimu/WidgetManager'

  ],

  function (

    declare,

    lang,

    BaseWidget,

    WidgetManager) {

      var clazz = declare([BaseWidget], {

 

          name: 'UrlButton',

          baseClass: 'widget-urlbutton',

          isOpening: false,

 

          onOpen: function () {

              if (!this.isOpening) {

                  this.isOpening = true;

                  //Get lat,long,scale start

                  var mapCeneter = this.map.extent.getCenter();

                  var lat = mapCeneter.getLatitude();

                  var lon = mapCeneter.getLongitude();

 

                  var minxx = this.map.extent.xmin;

                  var minyy = this.map.extent.ymin;

                  var maxxx = this.map.extent.xmax;

                  var maxyy = this.map.extent.ymax;

 

Do I have to use toUtm(point, conversionMode, addSpaces)

https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-coordinateFormatter.html...

0 Kudos
11 Replies
RobertScheitlin__GISP
MVP Emeritus

Raju,

  Notice that geometries is plural not singular.

params.geometries = [mapPnt];

Then

You are specifying that the point SR is 4326 and then you are saying you want to project it to 4326 by using this line:

params.outSR = outSR;

???

Next you have:

params.transformation = 4326;

which is not correct. Depending on what the original points SR is and what SR you are projecting to you like do not need this at all.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Raju,

   Did this info help?

0 Kudos