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) {

Aforementioned code only works if I leave the projection change out. Following code is how the graphics array is formed

var symbol = new PictureMarkerSymbol();
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);
  • can you share your code or sample? – emredelioglu Oct 12 '16 at 16:43
  • updated with sample code – Jabran Saeed Oct 17 '16 at 3:15
  • Are you sure the extent returned by GraphicsExtent is valid? If you've only added a single point to the graphics, aren't you then setting the map extent to a single point? – jon_two Oct 17 '16 at 7:29
  • actually this is inside a loop. can confirm array is being populated perfectly and the extent object looks to be normal but i could be wrong. – Jabran Saeed Oct 17 '16 at 9:02
  • 1
    new point which coordinate system 4326 or SVY21/3414 var point = new Point({x:latlng[0],y:latlng[1]}); – emredelioglu Oct 17 '16 at 10:01

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.