我是 ESRI Javascript API 的新手。我不明白 attr 上需要做什么就行了,用新的图形。
var graphic = new esri.Graphic(geoPoint, symbol, attr, infoTemplate);
这是我捆绑在一起的许多示例代码中的最后一部分。有人请提出解决方案。谢谢您的帮助。下面是整个函数。如果您需要整个脚本,请告诉我。
function onGeocodesuccess(results)
{
console.log(results);
var geoPoint = new esri.geometry.Point(results.utm_x, results.utm_y, map.spatialReference);
var symbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE, 15, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0,0,255]), 2), new dojo.Color([0,0,255]));
var infoTemplate = new esri.InfoTemplate("Attributes", "${*}");
var graphic = new esri.Graphic(geoPoint, symbol, attr, infoTemplate);
map.graphics.add(graphic);
map.infoWindow.setTitle(graphic.getTitle());
map.infoWindow.setContent(graphic.getContent());
var screenPnt = map.toScreen(geoPoint);
map.infoWindow.show(screenPnt,map.getInfoWindowAnchor(screenPnt));
}