I am trying to create a very basic map and plot some hard coded points on it. Below is code and the highlighted line gives an error "esri is not defined".
view.when(function(){
var draw = new Draw({
view: view
});
var symbol = {
type: "simple-marker", // autocasts as new SimpleMarkerSymbol()
style: "square",
color: "blue",
size: "8px", // pixels
outline: { // autocasts as new SimpleLineSymbol()
color: [ 255, 255, 0 ],
width: 3 // points
}
};
var points = {
"points": [[-122.63, 45.51], [-122.56, 45.51], [-122.56, 45.55], [-122.62, 45.00], [-122.59, 45.53]]
};
var mp = new esri.geometry.Multipoint(points);
var wm_mp = esri.geometry.geographicToWebMercator(mp);
});
Solved! Go to Solution.
Legacy style coding is not supported in the 4.x api. So you need to require the multipoint geometry type instead and just use the MultiPoint class instead.
Legacy style coding is not supported in the 4.x api. So you need to require the multipoint geometry type instead and just use the MultiPoint class instead.
Thanks that helps. Can you also guide regarding the usage of geographicToWebMercator() method to plot points?
Admin,
Sure just require this class:
webMercatorUtils | API Reference | ArcGIS API for JavaScript 4.6
In Case you are not familiar with AMD style coding: