10

I'm creating a web map of a university campus.

I have the map functioning, but I don't want to be able to pan off of the basemap, into whitespace.

Do you know of a function that will auto-pan the extent back to the basemap?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Sep 30, 2010 at 23:58
1

3 Answers 3

10

This sample shows one method to monitor the extent and keep the user from panning beyond the established limits.

http://arcscripts.esri.com/details.asp?dbid=16956

answered Oct 1, 2010 at 4:12
1
  • Nice find; bookmarked for when I'll eventually need it too. Commented Oct 1, 2010 at 14:11
1

I don't think there's a function to do it for you; you'll have to handle the onPan(extent, delta) event from Map, and see if the extent passed in from that event handler that is beyond your desired extents. If it is, you can forcefully set the map extents back. It might lack elegance, though - I haven't tried to see if the effect is a shaky map that's fighting the user.

answered Oct 1, 2010 at 1:50
1
  • I got it working using mcooper's answer, but yes, it does lack elegance. The map is shaky sometimes, but probably just needs some tweaking Commented Oct 1, 2010 at 22:54
0

My answer to this earlier question has a code example of how to accomplish this: https://gis.stackexchange.com/a/199366/72254

answered Jun 21, 2016 at 19:42

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.