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:
Full Extent:
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
Bengi,
Add this line of code somewhere after the map is created:
console.info(map.spatialReference.wkid);
I am getting error on this
Uncaught TypeError: Cannot read property 'wkid' of undefined
Bengi,
Then you are putting it before the map is ready.
Ok the output is this:
102100
Bengi,
The the data is returning in the correct WKID and you don't need to change it.
See if the changes I made to lines 7 and 18 help your issue.
var edgesResultFeatures = result.edges;
console.log(edgesResultFeatures);
var edgeGraphics;
for (var j = 0, jl = edgesResultFeatures.length; j < jl; j++) {
var featureSet = edgesResultFeatures[j].features;
for (var i = 0, il = featureSet.length; i < il; i++) {
edgeGraphics = new esri.Graphic(featureSet[i].geometry)
graphicsLayerTraceNetworkEdges.add(edgeGraphics);
}
}
var junctionsResultFeatures = result.junctions;
console.log(junctionsResultFeatures);
var junctionsGraphics;
for (var j = 0, jl = junctionsResultFeatures.length; j < jl; j++) {
var featureSet = junctionsResultFeatures[j].features;
for (var i = 0, il = featureSet.length; i < il; i++) {
junctionsGraphics = new esri.Graphic(featureSet[i].geometry);
graphicsLayerTraceNetworkJunctions.add(junctionsGraphics);
}
}
same! nothing on the Map! but on console!
Bengi,
Try adding line 7 below and share the console results with me.
var edgesResultFeatures = result.edges;
console.log(edgesResultFeatures);
var edgeGraphics;
for (var j = 0, jl = edgesResultFeatures.length; j < jl; j++) {
var featureSet = edgesResultFeatures[j].features;
for (var i = 0, il = featureSet.length; i < il; i++) {
console.log(featureSet[i]);
edgeGraphics = new esri.Graphic(featureSet[i].geometry)
graphicsLayerTraceNetworkEdges.add(edgeGraphics);
}
}
var junctionsResultFeatures = result.junctions;
console.log(junctionsResultFeatures);
var junctionsGraphics;
for (var j = 0, jl = junctionsResultFeatures.length; j < jl; j++) {
var featureSet = junctionsResultFeatures[j].features;
for (var i = 0, il = featureSet.length; i < il; i++) {
junctionsGraphics = new esri.Graphic(featureSet[i].geometry);
graphicsLayerTraceNetworkJunctions.add(junctionsGraphics);
}
}
There you are:
Bengi,
The value is already a graphic so you should try this:
var edgesResultFeatures = result.edges;
console.log(edgesResultFeatures);
var edgeGraphics;
for (var j = 0, jl = edgesResultFeatures.length; j < jl; j++) {
var featureSet = edgesResultFeatures[j].features;
for (var i = 0, il = featureSet.length; i < il; i++) {
//edgeGraphics = new esri.Graphic(featureSet.geometry)
graphicsLayerTraceNetworkEdges.add(featureSet[i]);
}
}
var junctionsResultFeatures = result.junctions;
console.log(junctionsResultFeatures);
var junctionsGraphics;
for (var j = 0, jl = junctionsResultFeatures.length; j < jl; j++) {
var featureSet = junctionsResultFeatures[j].features;
for (var i = 0, il = featureSet.length; i < il; i++) {
//junctionsGraphics = new esri.Graphic(featureSet.geometry);
graphicsLayerTraceNetworkJunctions.add(featureSet[i]);
}
}
I am afraid but still not working!