AnsweredAssumed Answered

Display only selected features on map using java script

Question asked by JZhangGDOT on Aug 21, 2018
Latest reply on Aug 23, 2018 by JZhangGDOT

Good morning everyone,


   I am trying to develop an application using ArcGIS JavaScript API, one of the function is draw a box on map and do the spatial query, then only the features inside or intersect with the box are display and all the rest feature should disappear. 

   currently I use spatial query from box and get all the feature OIDs and then add definition query like,

   OBJECTID in (123, 124, 1245, .....2111)


However since our map service point to Oracle database, oracle have limitation on number of values in the list, currently is 1000, so if there are more than 1000  values in the list, then definition query won't work, and the entire layer disappear. 

Can anyone point out other doable strategy to overcome such limitation in Oracle. I appreciate whoever replies. 

my current codes something like this:


function SpatialQuery_Complete(event) {
      console.log("selection count: " + event.features.length);
      window.statusbar.visible = true;
      var productionSum = 0;
      var defQueryFld = "OBJECTID";
      var definitionQueryWhere = defQueryFld + " IN (";
      for(var i = 0; i < event.features.length; i++){
            window.status= "Processing " + i + " of " + event.features.length;
            definitionQueryWhere = definitionQueryWhere + event.features[i].attributes.OBJECTID;
         if (i == (event.features.length - 1) )
                  definitionQueryWhere = definitionQueryWhere + ")";
                  definitionQueryWhere = definitionQueryWhere + ",";

      svcLayer.setLayerDefinitions([null, null,definitionQueryWhere, null, null]);  //set layer definition
      svcLayer.setVisibleLayers([2, 5]);  //turn on layer 




Dave Zhang @GDOT