我正在努力添加多个变量(作为点/点图形)。我创建了一个可行的,但不能添加更多的

时间:2019-04-12 20:23:57

标签: javascript

我正在尝试创建多个标记。我已经创建了一个可行的程序,但是当我尝试添加更多程序时将不起作用。 如果您可以引导我成功添加其他标记,那就太好了。

                // Create a point geometry (this is the location of the "JOHN BARSBY COMMUNITY SCHOOL" school)
            var point = new Point({
                x: -13798269.7982,
                y: 6300212.72922,
                spatialReference: { wkid: 102100 }
            });

    var point1 = new Point({
                x: -13798469.7982,
                y: 6301512.72922,
                spatialReference: { wkid: 102100 }
            }); 


    // Create a graphic and add the symbol and geometry to it
            var pointGraphic = new Graphic({
                symbol: pictureSymbol,
                geometry: point,
    attributes: {Name: " JOHN BARSBY COMMUNITY SCHOOL", Phone: "250-753-8211", URL: "http://jb.schools.sd68.bc.ca/"},
                popupTemplate: infoTemplate,
            });

            var pointGraphic1 = new Graphic({
                symbol: pictureSymbol,
                geometry: point,
                attributes: {Name: " JOHN BARSBY COMMUNITY SCHOOL", Phone: "250-753-8211", URL: "http://jb.schools.sd68.bc.ca/"},
                popupTemplate: infoTemplate,
            });

             // Add the graphics to the view's graphics layer
            view.graphics.add(pointGraphic, pointGraphic1);

    });

1 个答案:

答案 0 :(得分:0)

point1定义中使用pointGraphic1。两种图形都使用同一点。