Select to view content in your preferred language

FeatureLayer doesn't draw all features

569
2
05-07-2014 08:01 AM
ChipHankley1
Deactivated User
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>
0 Kudos
2 Replies
Noah-Sager
Esri Regular Contributor
Hi Chip,

Checking the query request from REST shows that 118 features are being returned from the setDefinition expression, so I don' think this is an issue with the code.

If you comment out setDefinition expression, you still only see a few features being drawn. I made a fiddle to show this. My hunch is that there is something going on with the features themselves related to how they were published.

Do the features have a value assigned to them in the unique value renderer from ArcMap? If so, perhaps an "all other values" category would help.

-Noah
0 Kudos
ChipHankley1
Deactivated User
Thanks Noah...
Do the features have a value assigned to them in the unique value renderer from ArcMap? If so, perhaps an "all other values" category would help.


Yes, all the features have a value that is represented with the UVR, AND there is an "<all other values>" which is turned on.  I think that this is shown in the REST endpoint:
[INDENT]
...
Default Symbol:
Style: esriSLSSolid
Color: [255, 255, 0, 255]
Width: 3
Default Label:
...
[/INDENT]

Also, I would think that if this was the problem, the features wouldn't render with the ArcGISDynamicMapServiceLayer, right?

In the meantime, I've got a workaround in that I'm just using a Query/Querytask to generate my popup.  That's primarily the reason why I was using the FeatureLayer.
0 Kudos