3

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);
Vince
20.5k16 gold badges49 silver badges65 bronze badges
asked Oct 10, 2016 at 10:11
7
  • can you share your code or sample? Commented Oct 12, 2016 at 16:43
  • updated with sample code Commented Oct 17, 2016 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? Commented Oct 17, 2016 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. Commented Oct 17, 2016 at 9:02
  • 1
    new point which coordinate system 4326 or SVY21/3414 var point = new Point({x:latlng[0],y:latlng[1]}); Commented Oct 17, 2016 at 10:01

1 Answer 1

0

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.

answered Nov 3, 2016 at 2:31

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.