AnsweredAssumed Answered

FeatureLayer doesn't draw all features

Question asked by chiphankley on May 7, 2014
Latest reply on May 8, 2014 by chiphankley
ArcGIS Server 10.2.2, Windows Server 2012
Javascript API 3.9

I have a FeatureLayer that is not returning all of the records (features) that I expect it to.

The FeatureLayer is based on

  • an Oracle Spatial View

  • is NOT SDE (i.e. uses native spatial type)

The feature class has a fair number of features in it, but I'm setting a definition query that will only return 120 records at a time.  If I grab the definition query and test it in ArcMap, it returns the records I expect, but the same definition query through JS only returns about 20 records (for the FeatureLayer).  The same definition query works as expected against a DynamicMapServiceLayer.

The following is a simple page that displays the problem.  I'm rendering the DynamicMapServiceLayer at a lower opacity so that you can see all the features, with the FeatureLayer on top demonstrating that only a portion of the features are rendered.

Note that I have tried both SNAPSHOT and ONDEMAND modes... the behavior is the same for each.

TIA...

Chip Hankley
Traveler Information Systems Developer
Traffic Operations and Safety (TOPS) Laboratory
Department of Civil and Environmental Engineering
University of Wisconsin-Madison

<!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>FeatureLayer On Demand</title> 

    <link rel="stylesheet" href="http://js.arcgis.com/3.9/js/dojo/dijit/themes/claro/claro.css"> 
    <link rel="stylesheet" href="http://js.arcgis.com/3.9/js/esri/css/esri.css">
    <style>
      html, body, #mapDiv {
        padding:0;
        margin:0;
        height:100%;
      }
    </style>
    <script src="http://js.arcgis.com/3.9/"></script> 
    <script> 
      var map;
      require([
        "esri/map", "esri/InfoTemplate", "esri/layers/FeatureLayer",
        "dojo/parser", "dojo/domReady!"
      ], function(
        Map, InfoTemplate, FeatureLayer, 
        parser
      ) {
        parser.parse();
        map = new Map("mapDiv", { 
          basemap: "gray",
          center: [-89.6, 44.5],
          zoom: 6
        });
       
        map.on("load", initOperationalLayer);

        function initOperationalLayer() {
          var defQuery = "POST like '%%' AND CONDITION like '%%' AND (UPDATED_ON_UNX < 1399457032226 AND MODIFIED_ON_UNX >= 1399457032226) OR (UPDATED_ON_UNX < 1399457032226 AND MODIFIED_ON_UNX IS NULL)";
          var URL = "http://transportal.cee.wisc.edu/services/arcgis/GIS2DEV/rest/services/WRS/WRS_HistoricConditions_DEV/MapServer/";
          var infoTemplate = new InfoTemplate("<b>${HWYLIST}</b> between <br/><b>${START_CITY}</b> and <b>${END_CITY}</b>");
          
          //FeatureLayer
          var featureLayer = new FeatureLayer(URL + "0",{
            mode: FeatureLayer.MODE_SNAPSHOT,
            outFields: ["*"],
            infoTemplate: infoTemplate
          });
          featureLayer.setDefinitionExpression(defQuery);
          
          //Dynamic Map Service Layer
          var DMSLayer = new esri.layers.ArcGISDynamicMapServiceLayer(URL, {"opacity":0.30});
          DMSLayer.setLayerDefinitions([defQuery],false);
          
          map.addLayer(featureLayer);
          map.addLayer(DMSLayer);
          map.infoWindow.resize(155,75);
        }
      });
    </script> 
  </head> 
  <body class="claro"> 
    <div id="mapDiv">
    </div>
  </body> 
</html>

Outcomes