基于Flex访问Arcgis Server的rest API中的Geometry server 坐标
发布时间:2020-12-15 04:08:54 所属栏目:百科 来源:网络整理
导读:参考:http://dcec226:8399/arcgis/sdk/rest/index.html?mapserver.html ?xml version="1.0" encoding="utf-8"?s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/fle
参考:http://dcec226:8399/arcgis/sdk/rest/index.html?mapserver.html <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"> <fx:Script> <![CDATA[ import mx.controls.Alert; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; protected function btnSend_clickHandler(event:MouseEvent):void { var params:URLVariables = new URLVariables(); var url:String="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer/project"; srv.url=url; params.inSR="4326"; params.outSR="102113"; params.geometries="{'geometryType':'esriGeometryPoint','geometries':[{'x':-117,'y':34}]}"; params.f="pjson"; srv.send(params); } private function gotResult(event:ResultEvent):void{ Alert.show(event.result as String); } private function gotError(event:FaultEvent):void{ Alert.show(event.toString()); } ]]> </fx:Script> <fx:Declarations> <mx:HTTPService id="srv" result="gotResult(event);" useProxy="false" fault="gotError(event)"/> </fx:Declarations> <s:Button id="btnSend" label="调用" click="btnSend_clickHandler(event)"/> </s:Application> HTTPService传送参数的第二种方式 <fx:Declarations> <!-- 将非可视元素(例如服务、值对象)放在此处 --> <!--定义HttpService发送请求--> <s:HTTPService id="service" url="http://localhost:8080/testhttpservice/testHttpServiceServlet" useProxy="false" fault="service_faultHandler(event)" result="service_resultHandler(event)"> <s:request > <!--参数名称作标签,中间填充参数值--> <username>{txtusername.text}</username> <password>{txtpassword.text}</password> </s:request> </s:HTTPService> </fx:Declarations> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |