How to make a form with Argis 3.40?

265
0
05-24-2022 07:54 AM
EdissonGabrielLópezSalamanca
New Contributor

Hello,

I did not find information on how I can make a form in version 3.40, but what I need, a form where I can insert the longitude and latitude where it shows it on the map once inserted.

For the time being, I add the points with a button:

Reference: Sample graphics add 

/**
   * The function is called initToolbar() and it creates a new Draw object called tb. The tb object is
   * then used to create a new event listener called "draw-end" which calls the addGraphic() function.
   * The function then creates a new event listener called "click" which listens for clicks on the
   * "info" div. If the click is on the "info" div, the function returns. If the click is on a button,
   * the function gets the id of the button and sets the tool variable to the id of the button. The map
   * navigation is then disabled and the tb object is activated with the tool variable.
   * @returns the value of the variable tb.
   */
  function initToolbar() {
    tb = new Draw(map);
    tb.on("draw-end", addGraphic);

    // event delegation so a click handler is not
    // needed for each individual button
    on(dom.byId("info"), "click", function (evt) {
      if (evt.target.id === "info") {
        return;
      }
      var tool = evt.target.id.toLowerCase();
      map.disableMapNavigation();
      tb.activate(tool);
    });
  }



 function addGraphic(evt) {
    //deactivate the toolbar and clear existing graphics
    tb.deactivate();
    map.enableMapNavigation();

    // figure out which symbol to use
    var symbol;
    if (evt.geometry.type === "point" || evt.geometry.type === "multipoint") {
      symbol = markerSymbol;
    } else {
      symbol = fillSymbol;
    }
    var graphic = new Graphic(evt.geometry, symbol, {Latitude: evt.geometry.getLatitude(), Longitude: evt.geometry.getLongitude()});
    var features = [graphic];

    featureLayer.applyEdits(features, null, null);

    map.infoWindow.setTitle("Localización");
            map.infoWindow.setContent("Latitud: "+evt.geometry.getLatitude()+ "Longitud: "+evt.geometry.getLongitude());
            map.infoWindow.show(graphic.geometry, map.getInfoWindowAnchor(graphic.geometry));
            map.centerAndZoom(graphic.geometry, 3);

    // map.graphics.add(new Graphic(evt.geometry, symbol));
  }

 But I can't figure out how to make a form.

I hope you can help me, thank you.

0 Kudos
0 Replies