加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

flex+gis显示地图的比例尺,坐标,地图显示范围

发布时间:2020-12-15 01:08:32 所属栏目:百科 来源:网络整理
导读:? Then use the toMapFromStage method to easily get those stage coordinates into map coordinates. -- ??? mx:Script ??????? ![CDATA[ ??????????? imp ort com.esri.ags.geometry.MapPoint; ??????????? private function loadHandler():void ????????
?

Then use the toMapFromStage method to easily get those stage coordinates into map coordinates.
-->
??? <mx:Script>
??????? <![CDATA[
??????????? import com.esri.ags.geometry.MapPoint;

??????????? private function loadHandler():void
??????????? {
??????????????? myMap.addEventListener(MouseEvent.MOUSE_MOVE,mouseMoveHandler);
??????????? }

??????????? private function mouseMoveHandler(event:MouseEvent):void
??????????? {
??????????????? const mapPoint:MapPoint = myMap.toMapFromStage(event.stageX,event.stageY);//获取当前鼠标的坐标转换成点。
??????????????? mousecoords.text = "Latitude: " + mapPoint.y.toFixed(6)?//点的Y值坐标(保留六位小数)
??????????????????? + "??? Longitude: " + mapPoint.x.toFixed(6);
??????????? }
??????? ]]>
??? </mx:Script>

??? <mx:HBox width="100%">
??????? <mx:Label text="Current map extent:" fontWeight="bold"/>
??????? <mx:Label text="xmin: {myMap.extent.xmin.toFixed(3)}"/>//地图显示范围的最小X值并保留三位小数
??????? <mx:Label text="ymin: {myMap.extent.ymin.toFixed(3)}"/>
??????? <mx:Label text="xmax: {myMap.extent.xmax.toFixed(3)}"/>
??????? <mx:Label text="ymax: {myMap.extent.ymax.toFixed(3)}"/>
??? </mx:HBox>
??? <mx:HBox width="100%">
??????? <mx:Label text="Current Mouse Coordinates:" fontWeight="bold"/>
??????? <mx:Label id="mousecoords" text="Move the mouse over the map to see its current coordinates..."/>
??? </mx:HBox>
??? <mx:HBox width="100%">
??????? <mx:Label text="Current map scale:" fontWeight="bold"/>
??????? <mx:Label text="1:{myMap.scale.toFixed(0)}"/>//地图比例尺(无小数位)
??? </mx:HBox>
??? <esri:Map id="myMap" load="loadHandler()">
??????? <esri:extent>
??????????? <esri:Extent xmin="-11" ymin="30" xmax="40" ymax="72">
??????????????? <esri:SpatialReference wkid="4326"/>
??????????? </esri:Extent>
??????? </esri:extent>
??????? <esri:ArcGISTiledMapServiceLayer
??????????? url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer"/>
??? </esri:Map>
</mx:Application>

?

http://1984yifeng.blog.163.com/blog/static/4728439120100273342756/

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读