Placing Info Window at xmax,ymax of Feature Extent

663
6
Jump to solution
01-15-2018 01:26 PM
ThomasMetos1
New Contributor II

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

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
ThomasMetos1
New Contributor II

I converted the x,y coordinates of the feature extent to latitude and longitude using

webMercatorUtils.xyToLngLat(xmax,ymax)

which solved the problem!

View solution in original post

0 Kudos
6 Replies
RobertScheitlin__GISP
MVP Emeritus

Thomas,

   is the extents maxy and maxx in the maps current viewable extent?

0 Kudos
ThomasMetos1
New Contributor II

Yes they are.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Thomas,

   Are you have the require to esri/Geometry/Point in your require list right? Does your browsers console show any errors?

0 Kudos
ThomasMetos1
New Contributor II

I do have it in the require list. I am not getting any console errors either. 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Very strange. Can you build a small sample that has this issue for testing?

0 Kudos
ThomasMetos1
New Contributor II

I converted the x,y coordinates of the feature extent to latitude and longitude using

webMercatorUtils.xyToLngLat(xmax,ymax)

which solved the problem!

0 Kudos