从arcgis层到html文本框显示属性值 [英] Display attribute value from arcgis layer to html textbox

查看:105
本文介绍了从arcgis层到html文本框显示属性值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用javascript

有人可以帮助我解决这个问题吗?
最好的问候.

Can anyone help me on this issue?
Best Regards.

推荐答案

只需单击一棵树,它将填充右上角的inputText

Just click on a tree, it will fill the inputText on the top right corner

<link rel="stylesheet" type="text/css" href="https://js.arcgis.com/3.19/esri/css/esri.css">
<style>
  html, body, #mapDiv {
    height: 100%;
    padding: 0;
    margin: 0;
  }
  #inputAttribute {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 300px;
  }
</style>

<script>var dojoConfig = { parseOnLoad:true };</script>
<script src="https://js.arcgis.com/3.19compact/"></script>
<script>
  require(["esri/map", "esri/layers/FeatureLayer", "dojo/on", "dojo/dom", "dojo/domReady!"], function(Map, FeatureLayer, On, Dom) {
    var node = Dom.byId('inputAttribute');
    var map = new Map("mapDiv", {
      center: [-122.41, 37.78],
      zoom: 17,
      basemap: "topo"
    });
    var featureLayer = new FeatureLayer("https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Street_Trees/FeatureServer/0",{
      outFields: ["qSpecies"]
    });
    map.addLayer(featureLayer);
    On(featureLayer, 'click', function (e) {
      node.value = e.graphic.attributes.qSpecies;
    });
  });
</script>
<div id="mapDiv"></div>
<input type="text" name="attribut" id="inputAttribute">

这篇关于从arcgis层到html文本框显示属性值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆