I am attempting to place Info windows at the [xmax,ymax] of a feature extent. I have attempted using the following code.
var extent = new esri.geometry.Extent(feature.geometry.getExtent()); var xmax = extent.xmax; var ymax = extent.ymax; var location = new Point([xmax,ymax]); map.infoWindow.show(location); The labels do not appear. I extracted the xmax and ymax values as discussed in This thread. When I replace:map.infoWindow.show(location); with...
map.infoWindow.show(feature.geometry.getCentroid());
The labels appear in the center of the feature as they should. So is something incorrect about the way I create the point? I have attempted most formats in The Point Documentation, with no luck. Any ideas where I should go from here?
Thanks
Solved! Go to Solution.
I converted the x,y coordinates of the feature extent to latitude and longitude using
webMercatorUtils.xyToLngLat(xmax,ymax)
which solved the problem!
Thomas,
is the extents maxy and maxx in the maps current viewable extent?
Yes they are.
Thomas,
Are you have the require to esri/Geometry/Point in your require list right? Does your browsers console show any errors?
I do have it in the require list. I am not getting any console errors either.
Very strange. Can you build a small sample that has this issue for testing?
I converted the x,y coordinates of the feature extent to latitude and longitude using
webMercatorUtils.xyToLngLat(xmax,ymax)
which solved the problem!