ability to rotate map

4100
3
03-06-2014 07:46 AM
JasonTrook
New Contributor II
Hello,
Is it possible, via a widget or other means, to rotate the orientation of my map.  By default north is at the top of the screen but I would like to be able to view my map facing E, S, W and other directions too.
Thanks,
Jason
Tags (2)
3 Replies
BjornSvensson
Esri Regular Contributor
Is it possible, via a widget or other means, to rotate the orientation of my map.  By default north is at the top of the screen but I would like to be able to view my map facing E, S, W and other directions too.


Yes.

In the viewer you can set the map rotation in the main config file to be whatever you want.  See the documentation at http://resources.arcgis.com/en/help/flex-viewer/concepts/index.html#/Map_content/01m30000005p000000/

You could also create your own widget that support changing the rotation interactively.  There's an API sample that does that: https://developers.arcgis.com/flex/sample-code/map-rotation.htm (move the "N" on the rotator circle in the upper left to rotate the map interactively).
0 Kudos
DilsonKitoko
New Contributor III

Hi Bjorn

I was able to able to migrate the sample to a compiled widget.

By the way, the tool is not interacting with the map. I can rotate the "wheel" , I can click on "N" to center the weehl. But nothing happens in the map. I suspect that it's because I've ommitted the following line from the sample (I didn't figure out how to implement this part in to the widget):

<esri:center>
            <esri:MapPoint x="-10051125" y="4669530"/>
        </esri:center>
        <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>
    </esri:Map>

Here is my code :

<?xml version="1.0" encoding="utf-8"?>

<viewer:BaseWidget xmlns:fx="http://ns.adobe.com/mxml/2009"

xmlns:s="library://ns.adobe.com/flex/spark"

xmlns:esri="http://www.esri.com/2008/ags"

xmlns:viewer="com.esri.viewer.*"

xmlns:components="widgets.RotateMap.components.*">

<fx:Script>

<![CDATA[

import com.esri.ags.Map;

import com.esri.ags.geometry.MapPoint;

import com.esri.viewer.AppEvent;

import com.esri.viewer.utils.LocalizationUtil;

import mx.collections.ArrayCollection;

import mx.events.FlexEvent;

]]>

</fx:Script>

<fx:Declarations>

<!-- Place non-visual elements (e.g., services, value objects) here -->

</fx:Declarations>

<esri:Map id="map"

crosshairVisible="true"

level="17"

middleButtonRotationEnabled="true"

wrapAround180="true"

zoomSliderVisible="false">

</esri:Map>

<components:RotationWheel id="wheel"

width="75" height="75"

left="20" top="20"

change="map.rotateTo(wheel.mapRotation, wheel.mapRotation == 0)"

mapRotation="{map.mapRotation}"

skinClass="widgets.RotateMap.skins.RotationWheelSkin"/>

</viewer:BaseWidget>

Any tip on this issue?

Thanks in advance

Dilson

0 Kudos
DilsonKitoko
New Contributor III

Question solved, I was totally misunderstanding the concept between a sample and passing into a widget format. I just had to remove the class esr:map and voila, the Rotate Wheel interacts with the my WebGIS application.                    

0 Kudos