I have a website that is working in a disconnected environment using the esri javascript 4.12 on a local server, and a local ArcGIS Server v10.5. We are using the normalizeUtils.normalizeCentralMeridian to plot polylines around the world.
The first error we got when running our code was that it couldn't connect to "https://utility.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer".
We then updated our call to call our local server and the error we get is:
TypeError: Cannot read property 'query' of undefined
at Object.<anonymous> (dojo.js:1460)
at e (dojo.js:187)
at Object.next (dojo.js:186)
at dojo.js:189
at Object.f [as create] (dojo.js:190)
at dojo.js:188
at Object.b.cut (dojo.js:1460)
at dojo.js:1455
at e (dojo.js:187)
at Object.next (dojo.js:186)
We connected to the internet and passed "https://utility.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer" as the GeometryService, which it does by default and we get the same error.
Here is the code:
var geomSeven = geodesicUtils.geodesicDensify(new Polyline({
paths: [
[-104.881944444444, 39.3391666666667], [167.733333333333, 8.726378]
]
}), 100000);
const mercatorPolylineSeven = webMercatorUtils.geographicToWebMercator(geomSeven);
normalizeUtils.normalizeCentralMeridian(mercatorPolylineSeven, "https://utility.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer").then(([geom8]) => {
var circuit7 = new Graphic({
geometry: geom8,
attributes: {
ObjectID: 7,
Name: "Kwajalein to/from MDIOC",
Description: "Long haul communications",
SiteType: "COI Circuit",
Event: "FTT-23",
MBPSIn: "",
MBPSOut: ""
}
});
circuitGraphics.push(circuit7);
//Kwajalein to Roi Namur- REQT: FTT-23-IC-156 & 157
var geomEight = geodesicUtils.geodesicDensify(new Polyline({
paths: [
[167.733333333333, 8.726378], [167.471691, 9.397729]
]
}), 100000);
const mercatorPolylineEight = webMercatorUtils.geographicToWebMercator(geomEight);
normalizeUtils.normalizeCentralMeridian(mercatorPolylineEight, "http://mdaesr01:6080/arcgis/rest/services/Utilities/Geometry/GeometryServer").then(([geom9]) => {
var circuit8 = new Graphic({
geometry: geom9,
attributes: {
ObjectID: 8,
Name: "Kwajalein to/from MDIOC",
Description: "CNET",
SiteType: "COI Circuit",
Event: "FTT-23",
MBPSIn: "",
MBPSOut: "45.0"
}
});
circuitGraphics.push(circuit8);
CreateLayers();
});
}, function (errors) {
console.log(errors);
});
});
Are we doing something wrong with passing the geometryService as the second parameter?
Thanks for any help.
~Alan
Solved! Go to Solution.
I figured it out, you need to initialize the path as a new GeometryService first. So the code would be:
normalizeUtils.normalizeCentralMeridian(mercatorPolylineSeven, new GeometryService("https://utility.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer")).then(([geom8]) => {
Alan,
I am not sure if this will help, but normally you specify the geometry service your app will use this way:
https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#geometryServiceUrl
I figured it out, you need to initialize the path as a new GeometryService first. So the code would be:
normalizeUtils.normalizeCentralMeridian(mercatorPolylineSeven, new GeometryService("https://utility.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer")).then(([geom8]) => {