How to rotate a map on desktop pc?

2695
3
Jump to solution
09-30-2015 12:16 AM
PaulHaakma
Regular Contributor

How do you rotate a map on a desktop pc (am using Windows)?

On touch devices, there is a property that you can set to allow rotating the map by twisting using two fingers:

map.rotationByPinchingEnabled

I tried using a button that on clicked would set the map.rotation property which sort of works but ends up with a weird effect where the rectangle representing the map rotates leaving whitespace around the edge as per the attached screenshot. There must be another method?

maprotation.png

0 Kudos
1 Solution

Accepted Solutions
GarethWalters
Occasional Contributor III

Hi Paul,

You need to use map.setRotation().

map.setMapRotation(map.rotation - 15, 0,0)

Let me know how you go.

Cheers,

Gareth

View solution in original post

3 Replies
NeilAyres
MVP Frequent Contributor

On ArcGIS desktop you use the "Data Frame" toolbar to rotate the frame relative to the data.

But you are probably talking about some programmatic way of doing this.

0 Kudos
GarethWalters
Occasional Contributor III

Hi Paul,

You need to use map.setRotation().

map.setMapRotation(map.rotation - 15, 0,0)

Let me know how you go.

Cheers,

Gareth

PaulHaakma
Regular Contributor

Thanks Gareth - not sure how I missed seeing that one!

slight correction for anyone stumbing across this, the map property is map.mapRotation, the code I used in order to rotate around the center of the page...

map.setMapRotation(map.mapRotation + 15, (app.width * 0.5) , (app.height * 0.5)  )