AnsweredAssumed Answered

Error on creating module from sample

Question asked by sky12james on Mar 31, 2016
Latest reply on Mar 31, 2016 by sky12james

Hello All,

I try to create a module from Sample here:

Display identify results in popup | ArcGIS API for JavaScript

but got error message on "mapPoint" of undefined. Not sure how you send the map click point to module?

or Do you have simple sample for creating a mudule using query or identify?  Thank you.


1. index.html

<!DOCTYPE html>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
    <title>Identify with Popup</title>
    <link rel="stylesheet" href="">
      html, body, #map {
  <script type="text/javascript">  
                var dojoConfig = {  
                    packages: [{  
                        name: 'myCustomModule',  
                        location: location.pathname.replace(/\/[^/]+$/, '') + '/myCustomModule'  
    <script src=""></script>
      var map;
      ], function (
        Map, InfoTemplate, ArcGISDynamicMapServiceLayer, SimpleFillSymbol,
        SimpleLineSymbol, IdentifyTask, IdentifyParameters, Popup,
        arrayUtils, Color, moduleI, domConstruct
      ) {

        var popup = new Popup({
          fillSymbol: new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID,
            new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID,
              new Color([255, 0, 0]), 2), new Color([255, 255, 0, 0.25]))
        }, domConstruct.create("div"));
        map = new Map("map", {
          basemap: "satellite",
          center: [-83.275, 42.573],
          zoom: 18,
          infoWindow: popup
  map.on("click", function(){
    <div id="map"></div>




  InfoTemplate, ArcGISDynamicMapServiceLayer, SimpleFillSymbol,
  SimpleLineSymbol, IdentifyTask, IdentifyParameters, Popup,
  arrayUtils, Color, domConstruct

 var identifyTask, identifyParams;
 var parcelsURL = "";
        map.addLayer(new ArcGISDynamicMapServiceLayer(parcelsURL,
          { opacity: 0.55 }));
          identifyTask = new IdentifyTask(parcelsURL);
          identifyParams = new IdentifyParameters();
          identifyParams.tolerance = 3;
          identifyParams.returnGeometry = true;
          identifyParams.layerIds = [0, 2];
          identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_ALL;
          identifyParams.width = map.width;
          identifyParams.height = map.height;
          identifyParams.geometry = evt.mapPoint;
          identifyParams.mapExtent = map.extent;
          var deferred = identifyTask
            .addCallback(function (response) {
              // response is an array of identify result objects
              // Let's return an array of features.
              return, function (result) {
                var feature = result.feature;
                var layerName = result.layerName;
                feature.attributes.layerName = layerName;
                if (layerName === 'Tax Parcels') {
                  var taxParcelTemplate = new InfoTemplate("",
                    "${Postal Address} <br/> Owner of record: ${First Owner Name}");
                else if (layerName === 'Building Footprints') {
                  var buildingFootprintTemplate = new InfoTemplate("",
                    "Parcel ID: ${PARCELID}");
                return feature;
          // InfoWindow expects an array of features from each deferred
          // object that you pass. If the response from the task execution
          // above is not an array of features, then you need to add a callback
          // like the one above to post-process the response and return an
          // array of features.
 }); //define function