3

With my map set to WrapAround180: true, I have a icon list outside of the map that pans to a location on the map when you select an icon in the list. If you are outside of the initial extent and select an icon in one of the maps wrap around extents, it will pan all the way to the initial extent instead of in the extent that the user is currently viewing. Is there a way to convert the initial extent geometry of a point to be the current extent geometry so the icons popup will open regardless of whatever extent you are in?

I tried:

screenUtils.toMapGeometry(this.map.extent, this.map.width, this.map.height, currG.geometry)

but this is giving me a very large number that is not located on the map. my geometry points are in SR 102100.

0

You have to use the width and height in screen units (see ESRI Doc). That means: the width and height of the map DOM Element (in pixels), otherwise you provide only information about the Geographic Coordinate System and nothing about the Screen Coordinate System, and the transformation is wrong.

var mapDiv = document.getElementById("map");

var width = mapDiv.clientWidth;
var height = mapDiv.clientHeight;

var pixels = ScreenUtils.toScreenGeometry(map.extent, width, height, feature.geometry);

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.