<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:esri="http://www.esri.com/2008/ags" xmlns:s="library://ns.adobe.com/flex/spark" pageTitle="Project a point"> <s:layout> <s:VerticalLayout paddingBottom="15" paddingLeft="15" paddingRight="15" paddingTop="15"/> </s:layout> <fx:Script> <![CDATA[ import com.esri.ags.Graphic; import com.esri.ags.SpatialReference; import com.esri.ags.events.GeometryServiceEvent; import com.esri.ags.geometry.Geometry; import com.esri.ags.geometry.MapPoint; import com.esri.ags.geometry.Polygon; import mx.controls.Alert; private function projectNow():void { //var outSR:SpatialReference = new SpatialReference(wkid.selectedItem.data); // Note: GeometryService takes in geometries instead of graphics as input var geomPolygon:Polygon = new Polygon( [[new MapPoint(-12480617.814858563,4396253.404548177), new MapPoint(-12480532.062067455,4396095.992043047), new MapPoint(-12480770.688915139,4396100.530491602), new MapPoint(-12480617.814858563,4396253.404548177)]],new SpatialReference(102100)) var outSR:SpatialReference = new SpatialReference(NaN,'PROJCS["NAD_1983_HARN_StatePlane_Illinois_East_FIPS_1201",GEOGCS["GCS_North_American_1983_HARN",DATUM["D_North_American_1983_HARN",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",984250.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-88.33333333333333],PARAMETER["Scale_Factor",0.999975],PARAMETER["Latitude_Of_Origin",36.66666666666666],UNIT["Foot_US",0.3048006096012192]]'); fromTxt.text = ""; fromTxt.text = geomPolygon.toString(); geometryService.project([ geomPolygon as Geometry ], outSR); } private function projectCompleteHandler(event:GeometryServiceEvent):void { try { fromTxt.text+= event.result.toString(); } catch (error:Error) { Alert.show(error.toString()); } } private function onFault(info:Object, token:Object = null):void { Alert.show(info.toString()); } protected function button1_clickHandler(event:MouseEvent):void { projectNow(); } ]]> </fx:Script> <fx:Declarations> <esri:GeometryService id="geometryService" concurrency="last" fault="onFault(event)" projectComplete="projectCompleteHandler(event)" url="http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"/> </fx:Declarations> <s:VGroup width="100%" height="100%" > <esri:Map wrapAround180="true" id="myMap" > <esri:extent> <esri:Extent id="lower48" xmin="-14305000" ymin="2748000" xmax="-6815000" ymax="7117000"> <esri:SpatialReference wkid="102100"/> </esri:Extent> </esri:extent> <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/> <esri:GraphicsLayer id="myGraphicsLayer"> <esri:symbol> <!-- Symbol to clearly mark the point to be projected --> <esri:SimpleMarkerSymbol alpha="0.9" color="0xFFFF00" size="12" style="square"> <esri:SimpleLineSymbol color="0x000000"/> </esri:SimpleMarkerSymbol> </esri:symbol> </esri:GraphicsLayer> </esri:Map> <s:Button label="Project" click="button1_clickHandler(event)" /> <s:Scroller id="scroller" left="0" right="0" top="0" bottom="0" hasFocusableChildren="false" measuredSizeIncludesScrollBars="false" minViewportInset="1"> <!--- @copy spark.components.supportClasses.SkinnableTextBase#textDisplay --> <s:RichEditableText id="fromTxt" heightInLines="10" widthInChars="50"/> </s:Scroller> </s:VGroup> </s:Application>
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.