错误事件Dojo更改事件和查询要素图层

时间:2017-03-07 22:01:26

标签: dojo arcgis-js-api

  

从选择列表和要素图层,我尝试制作查询要素图层,但我不知道发生了什么

<select name="select1" id="select">
            <option value="Artesania">Artesania</option>
            <option value="Banco" selected="selected">Banco</option>
            <option value="Bar">Bar</option>
            <option value="Bodega">Bodega</option>
            <option value="Boutique">Boutique</option>
            <option value="Discoteca">Discoteca</option>
/select> 
  
   var mapMain;
    require([
            "esri/map",
            "dojo/ready",
            "dojo/parser",
            "dojo/on",
            "dojo/dom",

            "dijit/layout/BorderContainer",
            "dijit/layout/ContentPane",
            "esri/dijit/HomeButton",
            "esri/dijit/Scalebar",
            "esri/layers/FeatureLayer",
            "esri/tasks/QueryTask",
            "esri/tasks/query",
            "esri/symbols/SimpleMarkerSymbol",
            "esri/symbols/SimpleLineSymbol",
            "esri/Color",
            "dijit/form/Select"],
        function (Map,
                  ready,
                  parser,
                  on,
                  dom,
                  BorderContainer,
                  ContentPane,
                  HomeButton,
                  Scalebar,
                  FeatureLayer,
                  QueryTask,
                  Query,
                  SimpleMarkerSymbol,
                  SimpleLineSymbol,
                  Color
                  ) {


            ready(function () {

                 parser.parse();


            // Create the map
                mapMain = new Map("cpCenter", {
                    basemap: "topo",
                    center: [-5.61094, 36.016],
                    zoom: 15
                });//map

                var home = new HomeButton({
                map: mapMain
                }, "HomeButton");
                home.startup();//homebutton

                var scalebar = new Scalebar({
                map: mapMain,
                scalebarUnit: "dual"
                });//scalebar
  

我怀疑我的问题是事件发生变化

                on(select, "change", function(evt){                

                    var SeleccLocal = dom.byId("select").value;

                  alert("Valor del select es: " + SeleccLocal);
  

定义一个查询,之后我将创建一个要素图层

                    var query = new Query();
                    query.where = "Tienda = " + SeleccLocal;
                    query.returnGeometry = true;
                    console.log(query)   

>  Create a new symbol

                    var marker = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_SQUARE, 10,
                    new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,
                    new Color([255,0,0]), 1),
                    new Color([0,255,0,0.25]));
  

使用查询选择

创建FeatureLayer
                    var localOSM = new FeatureLayer(localesOSM);
                    localOSM.selectFeatures(query,FeatureLayer.SELECTION_NEW);
                    //localOSM.setDefinitionExpression("Tienda = Discoteca");
  

将符号添加到要素图层

                   localOSM.setSelectionSymbol(marker);
  

添加要素图层

                   mapMain.addLayer(localOSM);

                });//on select      

            });//ready
    });//requiere  
  
    

我总是得到同样的错误         dojo.io.script错误错误:无法执行查询。             在Object.h.load(ini​​t.js:885)             在init.js:191             在c(init.js:76)             在d(ini​​t.js:76)             在b.Deferred.resolve.callback(init.js:77)             在c(init.js:76)             在d(ini​​t.js:76)             在b.Deferred.resolve.callback(init.js:77)             在init.js:1507             在k(init.js:199)

  

0 个答案:

没有答案