VinayBa

Scipts Hangs when executing query

Discussion created by VinayBa on Aug 30, 2013
Latest reply on Aug 31, 2013 by VinayBa
HI

  I have a  service which is deployed in my local arcgis server which has world country boundries , when i load just a map it works fine but when i add a query task it hangs , the whole browser system and system hangs can anybody tell what could be the reason , i checked in firebug the query response is in milliseconds still it hangs but there are some other request like http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/2/0/3 and many more of these which take **** lot of time , please let me know what could the issue.Below is query code
var queryTask = new esri.tasks.QueryTask(url);
      var query = new esri.tasks.Query();
      query.returnGeometry = true;
                        query.where = "COUNTRY='India'";
dojo.connect(queryTask, "onComplete", function(featureSet) {
          //alert('calling queryTask'+featureSet);
       //map.graphics.clear();
        try{
         /*var sfs = new SimpleFillSymbol(SimpleFillSymbol.STYLE_FORWARD_DIAGONAL, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255, 0, 0]), 2), new Color([255, 255, 0, 0.5]));
         alert('somethign');*/
         
         var symbol = new SimpleFillSymbol(
          SimpleFillSymbol.STYLE_SOLID,
          new SimpleLineSymbol(
            SimpleLineSymbol.STYLE_SOLID,
            new Color([255,0,0,0.65]), 2
          ),
          new Color([255,0,0,0.35])
           );

         
         //QueryTask returns a featureSet.  Loop through features in the featureSet and add them to the map.
         dojo.forEach(featureSet.features,function(feature){
          alert('feature'+feature);
          var graphic = feature;
          graphic.setSymbol(symbol);
          alert("infoTemplate"+infoTemplate);
          graphic.setInfoTemplate(infoTemplate);
          alert("graphic"+graphic);
          alert("map.graphics"+map.graphics);
          map.graphics.add(graphic);
       
        });
       }catch(e){
         alert("e"+e);
       }
      });
     queryTask.execute(query);



initialization of map

var bounds = new Extent({
            "xmin":-16045622,
            "ymin":-811556,
            "xmax":7297718,
            "ymax":11142818,
            "spatialReference":{"wkid":102100}
          });
           map = new esri.Map("map", { 
          basemap: "streets", 
          zoom: 2 
        }); 
          var url = "http://10.32.9.106:6080/arcgis/rest/services/Demo/World_Countries_v1/MapServer/0";
          var fl = new FeatureLayer(url, {
            id: "world-regions"
            //infoTemplate: template
          });


    Below is the rest service

Layer: World_Countires_v1 (ID: 0)
Name: World_Countires_v1

Display Field: COUNTRY

Type: Feature Layer

Geometry Type: esriGeometryPolygon

Description:

Definition Expression:

Copyright Text:

Default Visibility: true

MaxRecordCount: 1000

Supported Query Formats: JSON, AMF

Min Scale: 0

Max Scale: 0

Supports Advanced Queries: false

Supports Statistics: false

Has Labels: false

Can Modify Layer: true

Can Scale Symbols: false

Extent:

    XMin: -179.99999999990004
    YMin: -89.99999999990001
    XMax: 180.00000000010002
    YMax: 83.66549107605236
    Spatial Reference: 4326  (4326)


Drawing Info:

    Renderer:
        Simple Renderer:
        Symbol:
            Style: esriSFSSolid
            Color: [252, 214, 197, 255]
            Outline:
                Style: esriSLSSolid
                Color: [110, 110, 110, 255]
                Width: 0 Label:
        Description: Transparency: 0
    Labeling Info:


HasZ: false

HasM: false

Has Attachments: false

HTML Popup Type: esriServerHTMLPopupTypeAsHTMLText

Type ID Field: null

Fields:

    FID ( type: esriFieldTypeOID , alias: FID )
    Shape ( type: esriFieldTypeGeometry , alias: Shape )
    OBJECTID ( type: esriFieldTypeInteger , alias: OBJECTID )
    COUNTRY ( type: esriFieldTypeString , alias: COUNTRY , length: 50 )
    CONTINENT ( type: esriFieldTypeString , alias: CONTINENT , length: 13 )
    ISO3A ( type: esriFieldTypeString , alias: ISO3A , length: 5 )
    ISO2 ( type: esriFieldTypeString , alias: ISO2 , length: 5 )


Supported Operations:   Query   Generate Renderer   Return Updates




Outcomes