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

基于Flex访问Arcgis Server的rest API中的Geometry server 坐标

发布时间:2020-12-15 04:03:23 所属栏目:百科 来源:网络整理
导读:? 参考:http://dcec226:8399/arcgis/sdk/rest/index.html?mapserver.html [plain] view plain copy print ? ?xml?version="1.0"?encoding="utf-8"??? s:Application?xmlns:fx="http://ns.adobe.com/mxml/2009"??? ???????????????xmlns:s="library://ns.ado

?

参考:http://dcec226:8399/arcgis/sdk/rest/index.html?mapserver.html


[plain] view plain copy print ?
  1. <?xml?version="1.0"?encoding="utf-8"?>??
  2. <s:Application?xmlns:fx="http://ns.adobe.com/mxml/2009"???
  3. ???????????????xmlns:s="library://ns.adobe.com/flex/spark"???
  4. ???????????????xmlns:mx="library://ns.adobe.com/flex/mx"?minWidth="955"?minHeight="600">??
  5. ??????
  6. ????<fx:Script>??
  7. ????????<![CDATA[??
  8. ????????????import?mx.controls.Alert;??
  9. ????????????import?mx.rpc.events.FaultEvent;??
  10. ????????????import?mx.rpc.events.ResultEvent;??
  11. ??
  12. ????????????protected?function?btnSend_clickHandler(event:MouseEvent):void??
  13. ????????????{??
  14. ????????????????var?params:URLVariables?=?new?URLVariables();??
  15. ??
  16. ????????????????var?url:String="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer/project";??
  17. ????????????????srv.url=url;??
  18. ??????????????
  19. ????????????????params.inSR="4326";??
  20. ????????????????params.outSR="102113";????
  21. ????????????????params.geometries="{'geometryType':'esriGeometryPoint','geometries':[{'x':-117,'y':34}]}";??
  22. ????????????????params.f="pjson";??
  23. ????????????????srv.send(params);??
  24. ????????????}??
  25. ??????????????
  26. ????????????private?function?gotResult(event:ResultEvent):void{????
  27. ????????????????Alert.show(event.result?as?String);????
  28. ????????????}?????????????
  29. ??????????????
  30. ????????????private?function?gotError(event:FaultEvent):void{????
  31. ????????????????Alert.show(event.toString());????
  32. ????????????}????
  33. ??????????????
  34. ????????]]>??
  35. ????</fx:Script>??
  36. ??????
  37. ????<fx:Declarations>??
  38. ????????<mx:HTTPService?id="srv"?result="gotResult(event);"?useProxy="false"?fault="gotError(event)"/>??
  39. ????</fx:Declarations>??
  40. ????<s:Button?id="btnSend"?label="调用"?click="btnSend_clickHandler(event)"/>??
  41. </s:Application>??
<?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','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传送参数的第二种方式

[plain] view plain copy print ?
  1. <fx:Declarations>??
  2. ????<!--?将非可视元素(例如服务、值对象)放在此处?-->??
  3. ????<!--定义HttpService发送请求-->??
  4. ????<s:HTTPService?id="service"???
  5. ???????????????????url="http://localhost:8080/testhttpservice/testHttpServiceServlet"???
  6. ???????????????????useProxy="false"???
  7. ???????????????????fault="service_faultHandler(event)"???
  8. ???????????????????result="service_resultHandler(event)">????????????
  9. ????????<s:request?>??
  10. ????????????<!--参数名称作标签,中间填充参数值-->??
  11. ????????????<username>{txtusername.text}</username>??
  12. ????????????<password>{txtpassword.text}</password>??
  13. ????????</s:request>??
  14. ????</s:HTTPService>???
  15. </fx:Declarations>??

(编辑:李大同)

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

    推荐文章
      热点阅读