acrgis api for javaScript中的FeatureLayer查询
生活随笔
收集整理的這篇文章主要介紹了
acrgis api for javaScript中的FeatureLayer查询
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
acrgis api for javaScript中的FeatureLayer查詢:
1. 用api查詢
<script>require(["dojo/dom", "dojo/on","esri/tasks/query", "esri/tasks/QueryTask", "dojo/domReady!" ], function (dom, on, Query, QueryTask) {//獲取選擇圖層中的所有要素 var layerUrl ="https://geoplat.cloud.com/arcgis/rest/services/Hosted/earthquake19911995/FeatureServer" var queryTask = new QueryTask(layerUrl);var query = new Query();//query.returnGeometry = false; //query.outFields = ["objectid","time_","latitude","longitude","depth","mag"]; query.outFields = ["*"];//query.distance=3000; //query.objectIds= //query.num = 500; //query.start = 1; query.where = "1 = 1";queryTask.executeForCount(query,function(count){ console.log(count); }, function(error){console. log(error); });
var mm = queryTask. execute( query, showResults);
function showResults (results) { //返回的結果 console.log(results); }
</ script >
</ body >
</ html >
2.用ajax查詢:
<script type="text/javascript">function barAnalytize(){var url = 'https://geoplat.cloud.com/arcgis/rest/services/Hosted/earthquake19911995/FeatureServer/0/query'; $.ajax({type:"GET",url: url,data: {where:"1=1",outFields:"time_,latitude,longitude,depth,mag", f: "json" },dataType: 'json',success:function(data){alert(data.features[0].attributes.latitude);alert(data.features[0].attributes.mag);return data;},error:function(){alert(1);}}); </script>
總結
以上是生活随笔為你收集整理的acrgis api for javaScript中的FeatureLayer查询的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Scrapy定向爬虫教程(一)——创建运
- 下一篇: acrgis api for javaS