ESRI JS API Querytask有多个结果

时间:2014-04-25 16:32:52

标签: javascript arcgis esri arcgis-js-api

查询看起来像query.where = Abbrev =' BLOC'或者简称=' ZACH'或者简称=' 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 图像是chrome控制台的结果

因此看起来像var graphic = new Graphic(reGeo,symbol); 甚至&#39;为&#39;不起作用。

有人能给我一些想法吗?

1 个答案:

答案 0 :(得分:0)

这可能是名称空间问题,这有用吗? new esri.Graphic(reGeo,symbol);

另外,请确保&#34; esri / graphic&#34;模块通过require.js加载