AnsweredAssumed Answered

Create Point Graphic from Input boxes values

Question asked by roci_helix on Oct 17, 2019
Latest reply on Oct 18, 2019 by rscheitlin

Hello all,

I'm having trouble creating point graphic on a map from input values box.  Below are the code that I have.  I'm trying to get the lat and long values that is entered to plot on the map after the button is clicked.  Any help on how to get the global input values into the require() to generate the point graphic would be appreciated.  Thanks,


     <meta charset="utf-8">
     <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
     <title>Create Point Graphic</title>
           #viewDiv {
               padding: 0;
               margin: 0;
               height: 600px;
               width: 100%;
               margin-left: 100px;
               height: 100px;

     <link rel="stylesheet" href="">
     <script src=""></script>
          var longi = -96.867;
          var lati = 40.228;
          var lontest;
          var lattest;

          function plotPoint()
               lontest = document.getElementById("longInput").value;
               lattest = document.getElementById("latInput").value;
               alert("Long: "+lontest +" Lat: "+lattest);
          ], function(Map, MapView, Graphic, GraphicsLayer)
               var map = new Map({
                    basemap: "topo-vector"

               var view = new MapView({
                    container: "viewDiv", 
                    map: map,
                    center: [-96.8670, 40.228],
                    zoom: 6

               var graphicsLayer = new GraphicsLayer();
               // Create a point
               var point = {
                    type: "point",
                    longitude: lontest ,
                    latitude: lattest

               var simpleMarkerSymbol = {
                    type: "simple-marker",
                    color: [226, 119, 40],  // orange
                    outline: {
                          color: [12, 137, 148],
                          width: 1

               var pointGraphic = new Graphic({
                    geometry: point,
                    symbol: simpleMarkerSymbol


     <div id="getInput">
          <input id="latInput" type="text" name="latpoint">
          <input id="longInput" type="text" name="longpoint">
          <button onclick="plotPoint()"> Click Me</button>
  <div id="viewDiv"></div>