When the SketchViewModel is active, every time I move the mouse pointer I get the following warning on the browser console:
[esri.geometry.Point] .latitude= Longitude was defined without latitude
The mouse move event is fired very frequently, so after a few seconds you can end up with thousands of warnings. I'd rather get rid of this behavior if possible.
I have noticed that the warnings only appear if you use uncommon spatial references such as 2157 or 26711, while no warnings appear with other more familiar spatial references such as 4326 or 102100. I also noticed that when the warnings appear, the points get proper values for x and y but odd values for latitude and longitude:
latitude: null
longitude: NaN
I'm using the ArcGIS API for JavaScript 4.19. You can find a CodePen here.
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<title>Sketch widget | Sample | ArcGIS API for JavaScript 4.19</title>
<link rel="stylesheet" href="https://js.arcgis.com/4.19/esri/themes/light/main.css" />
<script src="https://js.arcgis.com/4.19/"></script>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/GraphicsLayer",
"esri/layers/MapImageLayer",
"esri/widgets/Sketch/SketchViewModel"
], (Map, MapView, GraphicsLayer, MapImageLayer, SketchViewModel) => {
const mapImageLayer = new MapImageLayer({
url: "http://sampleserver6.arcgisonline.com/arcgis/rest/services/VerticalLines/MapServer"
});
const graphicsLayer = new GraphicsLayer();
const map = new Map({
layers: [mapImageLayer, graphicsLayer]
});
const view = new MapView({
container: "viewDiv",
map: map,
scale: 75000
});
view.when(() => {
const sketch = new SketchViewModel({
layer: graphicsLayer,
view: view,
defaultCreateOptions: { hasZ: false }
});
sketch.create("point");
sketch.on("create", evt => {
if (evt.state === "complete") {
console.log(evt);
}
});
});
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>
Solved! Go to Solution.
Hi,
There was a bug logged for this in 4.19 (BUG-000139631), and we are working on getting this resolved for 4.20.
Thanks,
Jose
I am also seeing this issue
Hi,
There was a bug logged for this in 4.19 (BUG-000139631), and we are working on getting this resolved for 4.20.
Thanks,
Jose
I still have this issue with 4.20.2 and EPSG:2056 (Swiss projection). Is this a known issue?
Hello @NicoleSulzberger ,
Can you provide an example of a simple reproducible sample? I just tested EPSG:2056 and could not repro. If I revert back to 4.19 I can repro, but at 4.20 I don't see this.
Sorry for being so late 😞
Here is my example:
https://codepen.io/nsulzberger/pen/ExXKEpx?editors=1000
bye, Nicole
Hi @NicoleSulzberger ,
I cannot see the warning message from this issue on this sample you provided. I don't see the following warning message
[esri.geometry.Point] .latitude= Longitude was defined without latitude
If you change the version to 4.19, you will be able to see the warning message, but you won't be able to see it at 4.20. Are you still seeing this message? If you are, what browser are you using and what version?
Thanks,
Jose
I am using Chrome on Windows:
Google Chrome ist auf dem neuesten Stand.
Version 93.0.4577.63 (Offizieller Build) (64-Bit)
Yes, I see it was still reproducible with the reshape operation in 4.20. It was fixed in create mode, but not in reshape. This is a good find. I just tested with the latest cdn build and it seems to be resolved with both create and reshape. Can you confirm with this cdn?
Hi @JoseBanuelos,
Yes, it looks fine with this version. Thanks a lot for the deeper investigation!
bye, Nicole