简体   繁体   中英

ESRI JS API Querytask multiple results

Query looks like query.where = Abbrev = 'BLOC' OR Abbrev = 'ZACH' OR Abbrev = 'MSC'

function getLocRes(results) {
console.log("getLocRes",results);
var geom;
//geom = results.features[0].geometry;
//console.log("geom",geom);
//console.log("extent0",extent);
var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([80, 0, 0]), 2), new dojo.Color([80, 0, 0, 0.5]));
var res = results.features;
console.log("symbol",symbol);
console.log("res.length",res.length);
//map.graphics.clear();
for (var i = 0;i < res.length; i++) {
    console.log("i=",i);
    console.log("res[i].geometry=",res[i].geometry);
    var reGeo = res[i].geometry;
    var graphic = new Graphic(reGeo,symbol);
    var graphic = reGeo;
    console.log("graphic=",graphic);
    graphic.setSymbol(symbol);
    map.graphics.add(graphic);
    console.log(map.graphics.length);
}
//var extent = geom.getExtent();
alert(map.graphics.graphics.length);
//map.setExtent(extent, true);
console.log("extent1",extent);
}

http://www.dexconor.com/map/img/esri3.png the image is result in chrome console

so it seems like something wrong with var graphic = new Graphic(reGeo,symbol); even 'for' doesn't work.

Can anyone give me some ideas?

It might be a namespace issue, does this work? new esri.Graphic(reGeo,symbol);

also, make sure the "esri/graphic" module is loaded through require.js

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM