I have this script that defines a point, it draws the point at the correct location but it centers the map at the wrong place! Why?
Thanks.
startup: function() {
this.inherited(arguments);
pointSymbol = new SimpleMarkerSymbol(
SimpleMarkerSymbol.STYLE_CIRCLE, 10,
new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([0, 0, 0]), 1),
new Color([0, 204, 0])
);
myGraphicPoint = new Point([-121.07462622, 38.90015662]);
myGraphicMarker = new Graphic(myGraphicPoint, pointSymbol);
myGraphicMarker.setAttributes({"name":"Project Spot"});
myGraphicsLayer = new GraphicsLayer();
myGraphicsLayer.add(myGraphicMarker);
this.map.addLayer(myGraphicsLayer);
this.map.centerAndZoom(myGraphicPoint.geometry, 8);
},
Solved! Go to Solution.
Try changing this line:
this.map.centerAndZoom(myGraphicPoint.geometry, 8);
to:
this.map.centerAndZoom(myGraphicPoint, 8);
The Center and Zoom function takes a Point as the first argument.
Try changing this line:
this.map.centerAndZoom(myGraphicPoint.geometry, 8);
to:
this.map.centerAndZoom(myGraphicPoint, 8);
The Center and Zoom function takes a Point as the first argument.