1
2
3
4
5
6
7
8
9
10
11
require(["geoscene/Map", "geoscene/views/MapView"], (Map, MapView) => {
//// This is where you created a Map and MapView in the previous steps//// Create a line geometry with the coordinates of the lineconst polyline = {
type: "polyline", // autocasts as new Polyline()paths: [[-111.3, 52.68], [-98, 49.5], [-93.94, 29.89]]
};
});
1
2
3
4
5
6
7
8
9
10
11
12
13
require(["geoscene/Map", "geoscene/views/MapView"], (Map, MapView) => {
//// This is where you created a Map, MapView,// and geometry in the previous steps//// Create a simple line symbol for rendering the line in the viewconst lineSymbol = {
type: "simple-line", // autocasts as new SimpleLineSymbol()color: [226, 119, 40], // RGB color values as an arraywidth: 4 };
});
1
2
3
4
5
6
7
8
9
10
11
12
13
require(["geoscene/Map", "geoscene/views/MapView"], (Map, MapView) => {
//// This is where you created a Map, MapView,// geometry, and symbol in the previous steps//// Create a simple object containing useful information relating to the featureconst lineAtt = {
Name: "Keystone Pipeline", // The name of the pipelineOwner: "TransCanada", // The owner of the pipelineLength: "3,456 km"// The length of the pipeline };
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require(["geoscene/Map", "geoscene/views/MapView", "geoscene/Graphic"], (Map, MapView, Graphic) => {
//// This is where you created a Map, MapView,// geometry, symbol, and attributes in the previous steps//// Create the graphicconst polylineGraphic = new Graphic({
geometry: polyline, // Add the geometry created in step 4symbol: lineSymbol, // Add the symbol created in step 5attributes: lineAtt // Add the attributes created in step 6 });
// Add the graphic to the view's default graphics view// If adding multiple graphics, use addMany and pass in the array of graphics. view.graphics.add(polylineGraphic);
});