I have my map set to a custom projection SVY21/3414 This map service only supports Tiled and not Dynamic. I manually convert the projection coordinates using proj4 and it works fine for my graphics.
I can get an extent object using esri/GraphicsUtils of the graphics on map which seems to be valid. However if I try to set map extent to this object I get error
undefined ""
in dojo.js
If I leave out the projection change and stick to 4236 it works fine. I'm using version 3.17
Here's some sample code
require(["esri/graphicsUtils"], function(graphicsUtils) {
map.setExtent(graphicsUtils.graphicsExtent(arr));
});
Aforementioned code only works if I leave the projection change out. Following code is how the graphics array is formed
var symbol = new PictureMarkerSymbol();
symbol.setUrl(thisicon);
var latlng = proj4(projection,[longitude,latitude]);
var point = new Point({x:latlng[0],y:latlng[1]});
// "projection" is the wkt string
var graphic = new Graphic(point, symbol, attr, template);
map.graphics.add(graphic);
1 Answer 1
found out the issue was to give "Point" a spatialReference. emredelioglu you were right to point into that direction. Even though the graphics have spatialReference set to correct one automatically. Unless I deliberately give it to Point, it wont work with graphics extent.
var point = new Point({x:latlng[0],y:latlng[1]});