SHARE
TWEET

Untitled

a guest Jul 14th, 2017 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var webmap = new WebMap({
  2.         portalItem: { // autocasts as new PortalItem()
  3.           id: "797061fbb4284b8c8f694ae4066c600a"
  4.         }
  5.       });
  6.  
  7.      
  8.  
  9.       var view = new MapView({
  10.         container: "viewDiv",
  11.         map: webmap,
  12.         center: [-82.23, 34.94],
  13.         zoom: 11
  14.       });
  15.  
  16.  
  17.  
  18.        
  19.        //let's get a popup graphic on click:'
  20.      view.on("click", function(evt) {
  21.      var screenPoint = {
  22.         x: evt.x,
  23.         y: evt.y
  24.       };
  25.         console.log(screenPoint);
  26.      view.hitTest(screenPoint)
  27.       .then(getGraphics);
  28.       });
  29.   function getGraphics(response) {
  30.         console.log(response)
  31.       view.graphics.removeAll();
  32.       var graphic = new Graphic({
  33.         //gotta set a defined geometry for the symbol to draw
  34.         geometry: response.results[0].graphic.geometry,
  35.         symbol: new SimpleFillSymbol({
  36.            color: [255,255,0,0.0],
  37.            style: "solid",
  38.            outline: {
  39.                 color: [102,0,204],
  40.                 width: 5
  41.            }
  42.       })
  43.    });
  44.    
  45.    console.log(graphic);
  46.    view.graphics.add(graphic);
  47.    
  48.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top