How to Specify Out Unit to Be in Decimal Degree in JS API

3226
34
11-29-2017 03:53 PM
BehrouzHosseini
Occasional Contributor

I am using a Map service on ARcGIS Server 10.4.1 which is in this format

Spatial Reference: 102100  (3857) 
Single Fused Map Cache: false 
Initial Extent:

      XMin: -9819759.37726215
      YMin: 5128008.078704429
      XMax: -9809084.764440382
      YMax: 5132626.115644935
      Spatial Reference: 102100  (3857)

Full Extent:

      XMin: -9819004.6505
      YMin: 5125535.589900002
      XMax: -9809349.0802
      YMax: 5131992.668099999
      Spatial Reference: 102100  (3857)

 

Units: esriMeters 

Now when I query the service it returns the data in Meter format which I can not display back them on the map as new graphics. Can you please let me know how I can change the service configuration or OutUnit in ArcGIS JavaScript API to be in Decimal Degree

0 Kudos
34 Replies
BehrouzHosseini
Occasional Contributor

Yes I am getting result like

[  
   {  
      "displayFieldName":"",
      "fieldAliases":{  
         "OBJECTID":"OBJECTID"
      },
      "geometryType":"esriGeometryPoint",
      "spatialReference":{  
         "wkid":102100,
         "latestWkid":3857
      },
      "fields":[  
         {  
            "name":"OBJECTID",
            "type":"esriFieldTypeOID",
            "alias":"OBJECTID"
         }
      ],
      "features":[  
         {  
            "attributes":{  
               "OBJECTID":5270
            },
            "geometry":{  
               "x":-9814184.757,
               "y":5130582.574600004
            }
         },
         {  
            "attributes":{  
               "OBJECTID":5271
            },
            "geometry":{  
               "x":-9814152.5879,
               "y":5130624.636799999
            }
         },
         {  
            "attributes":{  
               "OBJECTID":5272
            },
            "geometry":{  
               "x":-9814147.7353,
               "y":5130632.882600002
            }
         },
         {  
            "attributes":{  
               "OBJECTID":5273
            },
            "geometry":{  
               "x":-9814131.0948,
               "y":5130659.340300001
            }
         },
         {  
            "attributes":{  
               "OBJECTID":5279
            },
            "geometry":{  
               "x":-9814141.8218,
               "y":5130548.319399998
            }
         },
         {  
            "attributes":{  
               "OBJECTID":5280
            },
            "geometry":{  
               "x":-9814144.0262,
               "y":5130563.046300001
            }
         },
         {  
            "attributes":{  
               "OBJECTID":5281
            },
            "geometry":{  
               "x":-9814082.9311,
               "y":5130580.8967999965
            }
         },
         {  
            "attributes":{  
               "OBJECTID":5282
            },
            "geometry":{  
               "x":-9814061.6542,
               "y":5130572.5336000025
            }
         },
         {  
            "attributes":{  
               "OBJECTID":5283
            },
            "geometry":{  
               "x":-9814050.6173,
               "y":5130533.271700002
            }
         },
         {  
            "attributes":{  
               "OBJECTID":5284
            },
            "geometry":{  
               "x":-9814007.1346,
               "y":5130542.435500003
            }
         },
         {  
            "attributes":{  
               "OBJECTID":5285
            },
            "geometry":{  
               "x":-9813994.5063,
               "y":5130541.110299997
            }
         },
         {  
            "attributes":{  
               "OBJECTID":5286
            },
            "geometry":{  
               "x":-9813938.9024,
               "y":5130552.8156
            }
         },
         {  
            "attributes":{  
               "OBJECTID":5287
            },
            "geometry":{  
               "x":-9813909.17,
               "y":5130560.038199998
            }
         },
         {  
            "attributes":{  
               "OBJECTID":5288
            },
            "geometry":{  
               "x":-9813904.3966,
               "y":5130569.3544000015
            }
         },
         {  
            "attributes":{  
               "OBJECTID":5289
            },
            "geometry":{  
               "x":-9813931.5632,
               "y":5130578.931599997
            }
         },
         {  
            "attributes":{  
               "OBJECTID":5290
            },
            "geometry":{  
               "x":-9813967.3654,
               "y":5130581.6382
            }
         },
         {  
            "attributes":{  
               "OBJECTID":5291
            },
            "geometry":{  
               "x":-9813997.9644,
               "y":5130589.073399998
            }
         },
         {  
            "attributes":{  
               "OBJECTID":5292
            },
            "geometry":{  
               "x":-9814047.1961,
               "y":5130610.299099997
            }
         },
         {  
            "attributes":{  
               "OBJECTID":5293
            },
            "geometry":{  
               "x":-9814057.6105,
               "y":5130616.874200001
            }
         },
         {  
            "attributes":{  
               "OBJECTID":5294
            },
            "geometry":{  
               "x":-9814086.3569,
               "y":5130632.1565999985
            }
         }
      ]
   },
   {  
      "displayFieldName":"",
      "fieldAliases":{  
         "OBJECTID":"OBJECTID"
      },
      "geometryType":"esriGeometryPoint",
      "spatialReference":{  
         "wkid":102100,
         "latestWkid":3857
      },
      "fields":[  
         {  
            "name":"OBJECTID",
            "type":"esriFieldTypeOID",
            "alias":"OBJECTID"
         }
      ],
      "features":[  
         {  
            "attributes":{  
               "OBJECTID":2385
            },
            "geometry":{  
               "x":-9814111.7328,
               "y":5130548.937399998
            }
         }
      ]
   },
   {  
      "displayFieldName":"",
      "fieldAliases":{  
         "OBJECTID":"OBJECTID"
      },
      "geometryType":"esriGeometryPoint",
      "spatialReference":{  
         "wkid":102100,
         "latestWkid":3857
      },
      "fields":[  
         {  
            "name":"OBJECTID",
            "type":"esriFieldTypeOID",
            "alias":"OBJECTID"
         }
      ],
      "features":[  
         {  
            "attributes":{  
               "OBJECTID":1392
            },
            "geometry":{  
               "x":-9814163.4375,
               "y":5130568.742899999
            }
         },
         {  
            "attributes":{  
               "OBJECTID":1413
            },
            "geometry":{  
               "x":-9814112.7478,
               "y":5130638.770000003
            }
         },
         {  
            "attributes":{  
               "OBJECTID":1446
            },
            "geometry":{  
               "x":-9814059.8415,
               "y":5130593.071400002
            }
         },
         {  
            "attributes":{  
               "OBJECTID":1459
            },
            "geometry":{  
               "x":-9814034.5062,
               "y":5130563.520999998
            }
         },
         {  
            "attributes":{  
               "OBJECTID":1487
            },
            "geometry":{  
               "x":-9814002.767,
               "y":5130565.1712
            }
         },
         {  
            "attributes":{  
               "OBJECTID":1497
            },
            "geometry":{  
               "x":-9813963.8602,
               "y":5130567.183799997
            }
         }
      ]
   },
   {  
      "displayFieldName":"",
      "fieldAliases":{  
         "OBJECTID":"OBJECTID"
      },
      "geometryType":"esriGeometryPoint",
      "spatialReference":{  
         "wkid":102100,
         "latestWkid":3857
      },
      "fields":[  
         {  
            "name":"OBJECTID",
            "type":"esriFieldTypeOID",
            "alias":"OBJECTID"
         }
      ],
      "features":[  
         {  
            "attributes":{  
               "OBJECTID":1047
            },
            "geometry":{  
               "x":-9813921.4125,
               "y":5130565.028099999
            }
         },
         {  
            "attributes":{  
               "OBJECTID":1050
            },
            "geometry":{  
               "x":-9814129.4325,
               "y":5130614.3423999995
            }
         }
      ]
   }
]‍‍

without using the

junctionsGraphics = new esri.Graphic(esri.geometry.webMercatorUtils.webMercatorToGeographic(featureSet[i].geometry));
0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Bengi,

   So what is your maps WKID? The data is returning in 102100 so why are you trying to change it to WGS84?

0 Kudos
BehrouzHosseini
Occasional Contributor

That is my issue! I am not able to display the graphics on the map!

0 Kudos
BehrouzHosseini
Occasional Contributor

Could it be because of Renderers?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Could you answer my last questions?

0 Kudos
BehrouzHosseini
Occasional Contributor

Well I thought I need to change the Meter unit to DD to be able to add the graphics on the  graphicsLayerTraceNetworkJunctions layer 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Bengi,

   If your map is in 102100 and you data is returning in 102100 then there is no reason to change anything and may be a renderer issue. 

Is you map in WKID 102100?

0 Kudos
BehrouzHosseini
Occasional Contributor

No Renderer is Ok I just test it as below

0 Kudos
RobertScheitlin__GISP
MVP Emeritus
No Renderer is Ok I just test it as below

???? below what ????

Is you map in WKID 102100?

0 Kudos
BehrouzHosseini
Occasional Contributor

Renderer is Ok 

I test it with hard coding the graphic and adding a Point like DD is working 

var point = new Point(-88.1681599642482, 41.796253348566786);
var pointGraphic = new esri.Graphic(point);
 graphicsLayerTraceNetworkJunctions.add(pointGraphic);

 

But same point in Meter Unit not displaying on the map

 

 var point = new Point(-9814834.6714, 5130507.876800001);
 var pointGraphic = new esri.Graphic(point);
 graphicsLayerTraceNetworkJunctions.add(pointGraphic);

 

and as you can see I am getting all point in Meter! Hoe can I check Map SpatialReference?

0 Kudos