Select to view content in your preferred language

Scipts Hangs when executing query

2333
10
08-30-2013 02:42 AM
vinayb
by
Deactivated User
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 hell 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




0 Kudos
10 Replies
VinayBansal
Frequent Contributor
Have you tried directly querying the rest service in browser?
http://10.32.9.106:6080/arcgis/rest/services/Demo/World_Countries_v1/MapServer/0/query

If not, try it and check if you are getting the result in browser directly.
0 Kudos
vinayb
by
Deactivated User
I have and get results quickly form both get and post but sometime get take long time.
0 Kudos
vinayb
by
Deactivated User
My Map behaves little picularly on load it looks different after load its diiferent is this issue, I have  attached the images please check  , how can i avaoid this.[ATTACH=CONFIG]27107[/ATTACH][ATTACH=CONFIG]27108[/ATTACH]
0 Kudos
VinayBansal
Frequent Contributor
In your code are you getting into the onComplete function? Means where is your process actually hanging?
Also , add error handling event to querytask
dojo.connect(queryTask, "onError", function(error) {
alert(error.description);
});
0 Kudos
vinayb
by
Deactivated User
I am getting in oncompete function i even able to see result of oncompelte too but i think issue is with behavior of map , i have added attachments in my last post for this thread , please look into that and please let me know if that is the issue , if so how can i avoid it.
0 Kudos
VinayBansal
Frequent Contributor
My Map behaves little picularly on load it looks different after load its diiferent is this issue, I have  attached the images please check  , how can i avaoid this.[ATTACH=CONFIG]27107[/ATTACH][ATTACH=CONFIG]27108[/ATTACH]


This may be due to the different projection system of your map. Do one thing set the coordinate system 102100 in you MXD data frame properties. And re-publish your service
0 Kudos
vinayb
by
Deactivated User
Currently we have WGS84 is this a problem
0 Kudos
VinayBansal
Frequent Contributor
Regarding your query hangs,have you added your geometry service and your service url in your proxy.config?
0 Kudos
vinayb
by
Deactivated User
NO , please let me know if i have to do it and if so how to do it
0 Kudos