Identify要素

<!DOCTYPE html><html>  <head>    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">        <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">    <title>Identify Sample</title>

    <link rel="stylesheet" href="https://js.arcgis.com/3.17/dijit/themes/claro/claro.css">    <link rel="stylesheet" href="https://js.arcgis.com/3.17/esri/css/esri.css">    <style>      html, body {        height: 98%;        width: 98%;        margin: 0;        padding: 5px;      }    </style>

    <script src="https://js.arcgis.com/3.17/"></script>    <script>      var map, bldgResults, parcelResults, symbol;

      require([        "esri/map",        "esri/layers/ArcGISDynamicMapServiceLayer",        "esri/symbols/SimpleFillSymbol",        "esri/symbols/SimpleLineSymbol",        "esri/tasks/IdentifyTask",        "esri/tasks/IdentifyParameters",        "dojo/on",        "dojo/parser",        "esri/Color",        "dijit/registry",        "dijit/form/Button",        "dijit/layout/ContentPane",        "dijit/layout/TabContainer",        "dojo/domReady!"      ],        function (          Map, ArcGISDynamicMapServiceLayer, SimpleFillSymbol, SimpleLineSymbol,          IdentifyTask, IdentifyParameters, on, parser, Color, registry        ) {

          parser.parse();

          var identifyTask, identifyParams;

            map = new Map("mapDiv", {              basemap: "streets",              center: [-83.275, 42.573],              zoom: 18            });            map.on("load", initFunctionality);

            var landBaseLayer = new ArcGISDynamicMapServiceLayer("https://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServer", {              opacity: 0.2            });            map.infoWindow.on("show", function () {              registry.byId("tabs").resize();            });            map.addLayer(landBaseLayer);

          function initFunctionality () {            map.on("click", doIdentify);

            identifyTask = new IdentifyTask("https://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServer");

            identifyParams = new IdentifyParameters();            identifyParams.tolerance = 3;            identifyParams.returnGeometry = true;            identifyParams.layerIds = [0, 2];            identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_ALL;            identifyParams.width = map.width;            identifyParams.height = map.height;

            map.infoWindow.resize(415, 200);            map.infoWindow.setContent(registry.byId("tabs").domNode);            map.infoWindow.setTitle("Identify Results");

            symbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID,              new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,                new Color([255, 0, 0]), 2),              new Color([255, 255, 0, 0.25]));          }

          function doIdentify (event) {            map.graphics.clear();            identifyParams.geometry = event.mapPoint;            identifyParams.mapExtent = map.extent;            identifyTask.execute(identifyParams, function (idResults) {              addToMap(idResults, event);            });          }

          function addToMap (idResults, event) {            bldgResults = { displayFieldName: null, features: [] };            parcelResults = { displayFieldName: null, features: [] };

            for (var i = 0, il = idResults.length; i < il; i++) {              var idResult = idResults[i];              if (idResult.layerId === 0) {                if (!bldgResults.displayFieldName) { bldgResults.displayFieldName = idResult.displayFieldName; }                bldgResults.features.push(idResult.feature);              }              else if (idResult.layerId === 2) {                if (!parcelResults.displayFieldName) { parcelResults.displayFieldName = idResult.displayFieldName; }                parcelResults.features.push(idResult.feature);              }            }            registry.byId("bldgTab").set("content", buildingResultTabContent(bldgResults));            registry.byId("parcelTab").set("content", parcelResultTabContent(parcelResults));

            map.infoWindow.show(event.screenPoint,              map.getInfoWindowAnchor(event.screenPoint));          }

          function buildingResultTabContent (results) {            var template = "";            var features = results.features;

                template += "<i>Total features returned: " + features.length + "</i>";                template += "<table border=‘1‘>";                template += "<tr><th>ID</th><th>Address</th></tr>";

                var parcelId;                var fullSiteAddress;                for (var i = 0, il = features.length; i < il; i++) {                  parcelId = features[i].attributes[‘PARCELID‘];                  fullSiteAddress = features[i].attributes[‘Full Site Address‘];

                  template += "<tr>";                  template += "<td>" + parcelId + " <a href=‘#‘ onclick=‘showFeature(bldgResults.features[" + i + "]); return false;‘>(show)</a></td>";                  template += "<td>" + fullSiteAddress + "</td>";                  template += "</tr>";                }

                template += "</table>";

            return template;          }

          function parcelResultTabContent (results) {            var template = "";            var features = results.features;

            template = "<i>Total features returned: " + features.length + "</i>";            template += "<table border=‘1‘>";            template += "<tr><th>ID</th><th>Year Built</th><th>School District</th><th>Description</th></tr>";

            var parcelIdNumber;            var residentialYearBuilt;            var schoolDistrictDescription;            var propertyDescription;            for (var i = 0, il = features.length; i < il; i++) {              parcelIdNumber = features[i].attributes[‘Parcel Identification Number‘];              residentialYearBuilt = features[i].attributes[‘Residential Year Built‘];              schoolDistrictDescription = features[i].attributes[‘School District Description‘];              propertyDescription = features[i].attributes[‘Property Description‘];

              template += "<tr>";              template += "<td>" + parcelIdNumber + " <a href=‘#‘ onclick=‘showFeature(parcelResults.features[" + i + "]); return false;‘>(show)</a></td>";              template += "<td>" + residentialYearBuilt + "</td>";              template += "<td>" + schoolDistrictDescription + "</td>";              template += "<td>" + propertyDescription + "</td>";              template += "</tr>";            }

            template += "</table>";

            return template;          }        });

      function showFeature (feature) {        map.graphics.clear();        feature.setSymbol(symbol);        map.graphics.add(feature);      }    </script>  </head>

  <body class="claro">    Click the map to identify building and tax information.    <div id="mapDiv" style="width:800px; height:600px; border:1px solid #000;"></div>        <div id="tabs" dojoType="dijit/layout/TabContainer" style="width:385px; height:150px;">      <div id="bldgTab" dojoType="dijit/layout/ContentPane" title="Buildings"></div>      <div id="parcelTab" dojoType="dijit/layout/ContentPane" title="Tax Parcels"></div>    </div>  </body></html>

运行结果:

https://developers.arcgis.com/javascript/3/samples/find_drilldown/

时间: 2024-08-10 15:10:10

Identify要素的相关文章

AE三维点击查询(3D Identify)的实现(转)

AE三维点击查询(3D Identify)的实现,类似ArcGIS的Identify对话框//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Function: 三维点击查询 3D Identify// Copyright ©  天下无双之dxcgis// 2008-5-8  于岳麓山

C# ArcEngine 实现点击要素高亮并弹出其属性

本文是模仿ArcMap里面的Identify(识别)功能,通过点击要素,使其高亮显示并弹出其属性表!本文只做了点击查询! 本文所用的环境为VS2010,AecEngine基于C#语言,界面是用Dev做的,比windows自带的窗体稍微好看点,效果如下: 主要实现代码(在axMapControl1_OnMouseDown下): 1 ITopologicalOperator pTopo; 2 IGeometry pGeometry; 3 IFeature pFeature; 4 IFeatureLa

ArcGIS for Android示例解析之高亮要素-----HighlightFeatures

转自:http://blog.csdn.net/wozaifeiyang0/article/details/7323606 HighlightFeatures 要素高亮化功能,相信有其他gis开发经营的开发人员都有过相应的实现经验,对于高亮要素,简单说起来就是我们查询的或识别出来的要素进行渲染,让其突出显示而已,这个例子中涉及后面要介绍的识别的内容,我们只简单介绍相关的知识,主要介绍要素对象的渲染(也就是所谓的高亮),来看代码: mapView.setOnLongPressListener(ne

云原生应用程序架构的五大特性(上)- 12要素应用

12要素的概念最早诞生于Heroku的工程师手中,说白了,其实就是云原生应用程序架构的模式集合,它描述了一个应用程序的原型,最好地诠释了采纳云原生应用程序架构的原因. 通过突出陈述性配置和水平扩展的无状态/无共享进程,以及整体上与部署环境的松耦合连接,这些模式实现了速度性.安全性和可扩展性.在当下,Cloud Foundry.Heroku和Amazon Elastic Beanstalk等云应用程序平台都已经为部署12要素应用进行了优化. 12要素视应用程序为可独立部署的单元,企业通常将多个可协

ArcGIS Engine问答:为什么地理数据库中不能产生同名要素类

之所以产生这样的问题,其原因是无论一个要素类是直接放在工作空问中,还是放在工作空问的一个要素数据集中,这些差别仅仅是逻辑上的,而它们的物理组成都是数据库中的一张二维表,并目表名就是要素类的名字,在一个数据库中不能出现两个同名的二维表,因此也就不能产生两个同名的要素类. 也就是说如果在工作空问中存在一个名为A的要素类和B的要素数据集,B中如果再产生一个名为A的要素类是不会成功的. 因此可以使用IFeatureWorkspace::OpenFeatureClass方法可以打开工作空问中的任何一个要素

将位图导入为ArcGIS面要素

本文根据笔者经验,介绍一种从位图图像导入ArcGIS称为要素的方法.这种方法适用于从现有出版物图片中获取地理信息的情况. 首先要说明的是,从位图导入要素是非常非常不精确的方式,如果有其它数据来源,那么就不应该采用此方法. 另外,如果位图包含的内容相对简单,区域结构紧凑不零散,则可以考虑ArcMap绘制地图,而不用此方法. 为让表述更直观,笔者从百度卫星地图截取了 辽宁省康平县 西泡子水库附近的区域,作为操作的说明. 00_orign 1. 制作灰度图 为便于在ArcMap中处理,将原始图像的色彩

Verilog HDL程序设计——基本要素

Verilog基本上熟悉了,继续整理一下Verilog的学习笔记吧.前面记载了Verilog的结构,写Verilog的结构有了,但是该怎么写呢?在写之前就得了解一下Verilog的一些基本要素了,也就是Verilog是怎么一点一点写出来的. 一.标识符与注释 前面已经说到,模块名的定义要符合标识符的定义,那么什么是标识符呢?它的语法是什么呢? ①标识符是赋给对象的唯一名称,通过标识符可以提及相应的对象,Verilog语法将对转义标识符中的字符逐个处理. ②标识符可以是字母.数字.下划线和美元符$

叶亚明:合格CTO的六要素(转)

叶亚明,携程旅行网CTO & 高级技术副总裁,负责携程的移动.Online.呼叫中心等的技术架构.开发及运营.在加入携程之前,叶亚明是ebay.com技术平台总监,领导ebay.com几代网站的架构和平台升级.他在美国加州硅谷拥有超过15年的互联网工作经验,曾经任职ebay.yahoo和 startup等. 在携程5年间经历了很多事情,我把这些归纳了一下,今天分享给大家,希望引起一些共鸣. 什么是技术领导力? 可以用一句话来概括CTO的技术领导力,就是"带领团队快速响应业务,并支持业务1

微服务开发的12项要素

spring cloud官方文档提到的服务开发的12项要素. I. Codebase从一个代码库部署到多个环境.II. Dependencies使用显式的声明隔离依赖,即模块单独运行,并可以显式管理依赖.III. Config在系统外部存储配置信息.IV. Backing Services把支持性服务看做是资源,支持性服务包括数据库.消息队列.缓冲服务器等.V. Build, release, run严格的划分编译.构建.运行阶段,每个阶段由工具进行管理.VI. Processes应用作为无状态