TransWikia.com

Panning to Point in WrapAround180 past initial extent in Arcgis Javascript API

Geographic Information Systems Asked by user145078 on December 23, 2020

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.

One Answer

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

Answered by Katah on December 23, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP