AnsweredAssumed Answered

DROP DOWN MENU

Question asked by satyanarayana_narmala on Jun 4, 2015
Latest reply on Jun 4, 2015 by rscheitlin

Hi

 

i am a beginer in programming. i am trying to create a drop down menu for my application, where on selecting a district the feature polygon should be highlighted and further mandal....

 

while loading it shows the error

 

ReferenceError: QueryTask is not defined

 

ReferenceError: query is not defined

 

 

here is the code.....where am i going wrong

 

<!DOCTYPE html>

<html>

  <head>

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

    <!--The viewport meta tag is used to improve the presentation and behavior of the samples

      on iOS devices-->

    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">

    <title>Popup</title>

 

    <link rel="stylesheet" href="http://js.arcgis.com/3.13/dijit/themes/claro/claro.css">

    <link rel="stylesheet" href="http://js.arcgis.com/3.13/esri/css/esri.css">

    <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.5/js/dojo/dijit/themes/claro/claro.css">

    <style>

      html, body, #map {

        padding: 0;

        margin: 0;

        height: 100%;

      }

 

      /* Change color of icons to match bar chart and selection symbol */

      .esriPopup.dark div.titleButton,

      .esriPopup.dark div.titlePane .title,

      .esriPopup.dark div.actionsPane .action {

        color: #A4CE67;

      }

      /* Additional customizations */

      .esriPopup.dark .esriPopupWrapper {

        border: none;

      }

      .esriPopup .contentPane {

        text-align: left;

      }

      .esriViewPopup .gallery {

        margin: 0 auto;

      }

    </style>

 

    <script src="http://js.arcgis.com/3.13/"></script>

    <script>

      var map;

      require([

        "esri/map",

        "esri/dijit/Popup", "esri/dijit/PopupTemplate",

        "esri/layers/FeatureLayer",

        "esri/dijit/Search",

        "esri/tasks/QueryTask",

        "esri/tasks/query",

        "esri/symbols/SimpleFillSymbol", "esri/Color",

        "dojo/dom-class", "dojo/dom-construct", "dojo/on",

        "dojox/charting/Chart", "dojox/charting/themes/Dollar",

        "dojo/domReady!"

      ], function(

        Map,

        Popup, PopupTemplate,

        FeatureLayer, Search,

        SimpleFillSymbol, Color,

        QueryTask, Query,

        domClass, domConstruct, on,

        Chart, theme

      ) {

        //The popup is the default info window so you only need to create the popup and

        //assign it to the map if you want to change default properties. Here we are

        //noting that the specified title content should display in the header bar

        //and providing our own selection symbol for polygons.

        var fill = new SimpleFillSymbol("solid", null, new Color("#A4CE67"));

        var popup = new Popup({

            fillSymbol: fill,

            titleInBody: false

        }, domConstruct.create("div"));

        //Add the dark theme which is customized further in the <style> tag at the top of this page

        domClass.add(popup.domNode, "lighter");

 

        map = new Map("map", {

          basemap: "satellite",

          center: [79.2, 18.10],

          zoom: 8,

          infoWindow: popup

        });

       

 

        var template = new PopupTemplate({

          title: "TELANGANA PATTA APPLICANTS",

          description: "Application No: {application_no} <br> <br>DISTRICT: {district_name1} <br><br>MANDAL: {mandal_name1}<br><br> VILLAGE: {village_name1} <br><br>  OCCUPANT NAME: {name_of_the_occupant} <br><br>ADDRESS: {present_address} <br><br> Survey No.: {survey_no} <br><br> LAND EXTENT: {extent_of_land} <br>",

        

       

        });

 

        var featureLayer = new FeatureLayer("http://gisserver.cgg.gov.in/arcgis/rest/services/sample/elands/MapServer/0",{

          mode: FeatureLayer.MODE_ONDEMAND,

          outFields: ["*"],

          infoTemplate: template

        });

        map.addLayer(featureLayer);

       

        var featureLayer2 = new FeatureLayer("http://gisserver.cgg.gov.in/arcgis/rest/services/sample/elands/MapServer/2",{

          mode: FeatureLayer.MODE_ONDEMAND,

          outFields: ["*"]

         

         

        });

        map.addLayer(featureLayer2);

       

        var featureLayer1 = new FeatureLayer("http://gisserver.cgg.gov.in/arcgis/rest/services/sample/elands/MapServer/1",{

          mode: FeatureLayer.MODE_ONDEMAND,

          outFields: ["*"]

         

        });

        map.addLayer(featureLayer1);

                               

      });

     

                     

    queryTask = new QueryTask("http://gisserver.cgg.gov.in/arcgis/rest/services/sample/elands/MapServer/2");

   

    query = new Query();

    query.returnGeometry = true;

    query.outFields = ["*"];

   

   

        function executeQueryTask(population) {

  //set query based on what user typed in for population;

alert(population);

  query.where = "MNAME = '" + population+"'";

 

  //execute query

  queryTask.execute(query,showResults);

}

 

function showResults(featureSet) {

  //remove all graphics on the maps graphics layer

  map.graphics.clear();

 

  //Performance enhancer - assign featureSet array to a single variable.

  var resultFeatures = featureSet.features;

 

  //Loop through each feature returned

  for (var i=0, il=resultFeatures.length; i<il; i++) {

    //Get the current feature from the featureSet.

    //Feature is a graphic

    var graphic = resultFeatures[i];

    graphic.setSymbol(symbol);

 

    //Set the infoTemplate.

    graphic.setInfoTemplate(infoTemplate);

 

    //Add graphic to the map graphics layer.

    map.graphics.add(graphic);

  }

}

 

    </script>

  </head>

 

  <body class="claro">

 

  

  <form name="classic">

<select name="countries" size="4" onChange="updatecities(this.selectedIndex)" style="width: 150px">

<option selected>Select A DISTRICT</option>

<option value="1">ADILABAD</option>

<option value="2">KARIMNAGAR</option>

<option value="3">KHAMMAM</option>

<option value="4">MAHABUBNAGAR</option>

<option value="5">MEDAK</option>

<option value="6">NALGONDA</option>

<option value="7">NIZAMABAD</option>

<option value="8">RANGA REDDY</option>

<option value="9">WARANGAL</option>

<option value="10">HYDERABAD</option>

</select>

 

Mandals:

<select name="cities" size="4" style="width: 150px" onClick="executeQueryTask(this.options[this.options.selectedIndex].value);">  <!-- alert(this.options[this.options.selectedIndex].value) -->

</select>

</form>

 

<script type="text/javascript">

 

var countrieslist=document.classic.countries

var citieslist=document.classic.cities

 

var cities=new Array()

cities[0]=""

cities[1]=["ADILABAD ", "    ASIFABAD ", "    BAZARHATHNOOR ", "    BEJJUR ", "    BELA ", "    BELLAMPALLE ", "    BHAINSA ", "    BHEEMINI  ", " BOATH ", "    CHENNUR ", "    DAHEGAON ", "    DANDEPALLE ", "    DILAWARPUR ", "    GUDIHATHNUR ", "    ICHODA ", "    INDERAVELLY ", "    JAINAD ", "    JAINOOR ", "    JAIPUR ", "    JANNARAM ", "    KADDAMPEDDUR ", "    KAGAZ NAGAR ", "    KASIPET ", "    KERAMERI ", "    KHANPUR     ", "    KOTAPALLE ", "    KOUTHALA ", "    KUBEER ", "    KUNTALA ", "    LAXMANCHANDA    ", "    LOHESRA ", "    LUXETTIPET     ", "    MAMDA     ", "    MANCHERIAL ", "        MANDAMARRI ", "        MUDHOLE     ", "    NARNOOR ", "    NENNAL ", "    NERADIGONDA ", "    NIRMAL ", "    REBBANA ", "    SARANGAPUR ", "    SIRPUR (T) ", "    SIRPUR (U) ", "    TALAMADUGU ", "    TAMSI     ", "    TANDUR ", "    TANUR ", " TIRYANI  ", "    UTNUR     ", "    VEMANPALLE     ", "    WANKDI"]

cities[2]=["BEJJANKI", "BHEEMADEVARPALLE", "BOINPALLE", "CHANDURTHI", "CHIGURUMAMIDI", "CHOPPADANDI", "DHARMAPURI", "DHARMARAM", "ELKATHURTHI", "ELLANTHAKUNTA", "GAMBHIRAOPET", "GANGADHARA", "GOLLAPALLE", "HUSNABAD", "HUZURABAD", "IBRAHIMPATNAM", "JAGTIAL", "JAMMIKUNTA", "JULAPALLE", "KAMALAPUR", "KAMANPUR", "KARIMNAGAR", "KATARAM", "KATHLAPUR", "KESAVAPATNAM", "KODIMIAL", "KOHEDA", "KONARAOPETA", "KORATLA", "MAHADEVPUR", "MALHARRAO", "MALLAPUR", "MALLIAL", "MANAKONDUR", "MANTHANI", "MEDIPALLE", "METPALLE", "MUSTABAD", "MUTHARAM MAHADEVPUR", "MUTHARAM MANTHANI", "ODELA", "PEDDAPALLE", "PEGADAPALLE", "RAIKAL", "RAMADUGU", "RAMAGUNDAM", "SAIDAPUR", "SARANGAPUR", "SIRSILLA", "SRIRAMPUR", "SULTANABAD", "THIMMAPUR", "VEENAVANKA", "VELGATOOR", "VEMULAWADA", "YELLA REDDI PETA"]

cities[3]=["ASWAPURAM", "ASWARAOPETA", "BAYYARAM", "BHADRACHALAM", "BONAKAL", "BURGAMPADU", "CHANDRUGONDA", "CHERLA", "CHINTHAKANI", "DAMMAPETA", "DUMMUGUDEM", "ENKURU", "GARLA", "GUNDALA", "JULURPAD", "KALLURU", "KAMEPALLE", "KHAMMAM RURAL", "KHAMMAM URBAN", "KONIJERLA", "KOTHAGUDEM", "KUSUMANCHI", "MADHIRA", "MANUGURU", "MUDIGONDA", "MULAKALAPALLE", "NELAKONDAPALLE", "PALAWANCHA", "PENUBALLI", "PINAPAKA", "SATHUPALLE", "SINGARENI", "TEKULAPALLE", "THALLADA", "THIRUMALAYAPALEM", "VEMSOOR", "VENKATAPURAM", "WAZEED", "WYRA", "YELLANDU", "YERRUPALEM"]

cities[4]=["ACHAMPETA", "ADDAKAL", "AIZA", "ALAMPUR", "AMANGAL", "AMRABAD", "ATMAKUR", "BALANAGAR", "BALMOOR", "BHOOTHPUR", "BIJINAPALLE", "BOMRASPETA", "CHINNA CHINTA KUNTA", "DAMARAGIDDA", "DEVARKADARA", "DHANWADA", "DHARUR", "DOULATABAD", "FAROOQNAGAR", "GADWAL", "GHANPUR", "GHATTU", "GOPALPETA", "HANWADA", "ITIKYAL", "JADCHERLA", "KALAWAKURTHY", "KESHAMPETA", "KODAIR", "KOILKONDA", "KOLLAPUR", "KONDANGAL", "KONDURG", "KOSGI", "KOTHAKONTA", "KOTHUR", "LINGAL", "MADDUR", "MADGUL", "MAGANOOR", "MAHABUBNAGAR", "MAKTHAL", "MALADAKAL", "MANOPADU", "MIDJIL", "NAGAR KURNOOL", "NARAYANPET", "NARVA", "NAWABPET", "PANGAL", "PEBBAIR", "PEDDAKOTHAPALLE", "PEDDAMANDADI", "TADOOR", "TALAKONDAPALLE", "TELKAPALLE", "THIMMAJIPETA", "UPPUNUNTHALA", "UTKOOR", "VANGOOR", "VEEPANGANDLA", "VELDANDA", "WADDEPALLE", "WANAPARTHY"]

cities[5]=["ALLADURG", "ANDOLE", "CHEGUNTA", "CHINNAKODUR", "DOULTHABAD", "DUBBAK", "GAJWEL", "HATHNOORA", "JAGDEVPUR", "JHARASANGAM", "JINNARAM", "KALHER", "KANGTI", "KOHIR", "KONDAPAK", "KONDAPUR", "KOWDIPALLI", "KULCHARAM", "MANOOR", "MEDAK", "MIRDODDI", "MULUGU", "MUNIPALLE", "NANGNUR", "NARAYANKHED", "NARSAPUR", "NYALKAL", "PAPANNAPET", "PATANCHERU", "PULKAL", "RAIKODE", "RAMACHANDRAPURAM", "RAMAYAMPET", "REGODE", "SADASIVPET", "SANGAREDDY", "SHANKARAMPET(A)", "SHANKARAMPET(R)", "SHIVAMPET", "SIDDIPET", "TEKMAL", "TOOPRAN", "WARGAL", "YELDURTHI", "ZAHIRABAD"]

cities[6]=["ALAIR", "ANUMULA", "ATMAKUR  (S)", "ATMAKUR (M)", "BHUVANAGIRI", "BIBINAGAR", "BOMMALARAMARAM", "CHANDAM PET", "CHANDUR", "CHILKUR", "CHINTHA PALLE", "CHITYALA", "CHIVVEMLA", "CHOUTUPPAL", "DAMERACHERLA", "DEVARAKONDA", "GARIDE PALLE", "GUNDALA", "GUNDLA PALLE", "GURRAMPODE", "HUZURNAGAR", "JAJI REDDI GUDEM", "KANGAL", "KATTANGOOR", "KETHEPALLE", "KODAD", "M TURKAPALLE", "MARRI GUDA", "MATTAMPALLE", "MELLACHERVU", "MIRYALAGUDA", "MOTHEY", "MOTHKUR", "MUNAGALA", "MUNUGODE", "NADIGUDEM", "NAKREKAL", "NALGONDA", "NAMPALLE", "NARAYANAPUR", "NARKETPALLE", "NERED CHERLA", "NIDAMANUR", "NUTHANKAL", "PEDDA ADISERLAPALLE", "PEDDAVURA", "PENPAHAD", "POCHAMPALLE", "RAJAPET", "RAMANNAPETA", "SALIGOURARAM", "SURYAPET", "THIPPARTHI", "THIRUMALAGIRI", "THRIPURARAM", "THUNGA THURTHI", "VALIGONDA", "VEMULAPALLE", "YADAGIRIGUTTA"]

cities[7]=["ARMUR", "BALKONDA", "BANSWADA", "BHEEMGAL", "BHIKNUR", "BICHKUNDA", "BIRKOOR", "BODHAN", "DHARPALLE", "DICH PALLE", "DOMAKONDA", "GANDHARI", "JAKRANPALLE", "JUKKAL", "KAMAREDDY", "KAMMAR PALLE", "KOTGIRI", "LINGAMPET", "MACHAREDDY", "MADNUR", "MAKLOOR", "MORTAD", "NAGA REDDIPET", "NANDIPET", "NAVIPET", "NIZAM SAGAR", "NIZAMABAD", "NIZAMABAD (M)", "PITLAM", "RANJAL", "SADASIVANAGAR", "SIRKONDA", "TADWAI", "VARNI", "VELPUR", "YEDA PALLE", "YELLAREDDY"]

cities[8]=["BALANAGAR", "BANTARAM", "BASHEERABAD", "CHEVELLA", "DHARUR", "DOMA", "GANDEED", "GHATKESAR", "HAYATHNAGAR", "IBRAHIMPATAM", "IBRAHIMPATNAM", "KANDUKUR", "KEESARA", "KULKACHARLA", "MAHESWARAM", "MALKAJGIRI", "MANCHAL", "MARPALLE", "MEDCHAL", "MOINABAD", "MOMINPET", "NAWABPET", "PARGI", "PEDDEMUL", "PUDUR", "QUTHBULLAPUR", "RAJENDRANAGAR", "SAROORNAGAR", "SERLINGAMPALLY", "SHABAD", "SHAMIRPET", "SHAMSHABAD", "SHANKARPALLE", "TANDUR", "UPPAL", "VIKARABAD", "YACHARAM", "YELAL"]

cities[9]=["ATMAKUR", "BACHANNAPETA", "BHUPALPALLE", "CHENNARAOPET", "CHERIYAL", "CHITYAL", "DEVARUPPULA", "DHARMASAGAR", "DORNAKAL", "DUGGONDI", "ETURNAGARAM", "GEESUGONDA", "GHANAPUR", "GHANPUR(stn)", "GOVINDARAOPET", "GUDUR", "HANAMKONDA", "HASANPARTHY", "JANGAON", "KESAMUDRAM", "KHANAPUR", "KODAKANDLA", "KOTHAGUDEM", "KURAVI", "LINGALA GHANPUR", "MADDUR", "MAHABUBABAD", "MANGAPET", "MARIPEDA", "MOGULLAPALLE", "MULUG", "NALLABELLY", "NARMETTA", "NARSAMPET", "NARSIMHULAPET", "NEKKONDA", "NELLIKUDUR", "PALAKURTHI", "PARKAL", "PARVATHAGIRI", "RAGHUNATHA PALLE", "RAIPARTHY", "REGONDA", "SANGEM", "TADVAI", "THORRUR", "VENKATAPUR", "WARANGAL", "WARDHANNAPET", "ZAFFERGADH"]

cities[10]=["HYDERABAD"]

 

function updatecities(selectedcitygroup){

    citieslist.options.length=0

    if (selectedcitygroup>0){

        for (i=0; i<cities[selectedcitygroup].length; i++)

            citieslist.options[citieslist.options.length]=new Option(cities[selectedcitygroup][i].split("|")[0], cities[selectedcitygroup][i].split("|")[1])

    }

}

 

</script>

 

    <div id="map"></div>

   

  </body>

 

</html>

Outcomes