Arcgis ignores extent definition

79
1
03-20-2019 04:07 PM
davidzornosa
New Contributor III

Hi, In arcgis js 3.25 I have a map that displays only one layer.

Said layer is known to be in srid 4686

var bounds = new Extent({
            "xmin" : -83.00,
            "ymin" : -4.60,
            "xmax" : -66.00,
            "ymax" : 13.0,
            "spatialReference" : {
                "wkid" : 4686
            }
});

var MAP = new Map("divCont", {
            extent: bounds,
            slider : false,
            logo : false,
            showAttribution : false
});   

var fl = new FeatureLayer(LAYER_URL+ "/0", {
    id: "myFl",
    mode: FeatureLayer.MODE_SNAPSHOT,
    outFields:["*"]
});        

fl.setDefinitionExpression("attribute=2");
MAP.addLayer(fl);

However, no matter what extent i set, Arcgis always ignores it.

Any ideas?

thank you

Tags (2)
0 Kudos
1 Reply
KenBuja
MVP Honored Contributor

This works:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
<title>Simple Map</title>
<link rel="stylesheet" href="https://js.arcgis.com/3.27/esri/css/esri.css">
<style>
html, body, #map {
height: 100%;
margin: 0;
padding: 0;
}
</style>
<script src="https://js.arcgis.com/3.27/"></script>
<script>
var map;

require([ "esri/map", "esri/geometry/Extent", "esri/layers/ArcGISDynamicMapServiceLayer"
], function(Map, Extent, ArcGISDynamicMapServiceLayer) {
var map = new Map("map", {
extent: new Extent({xmin:-83.00,ymin:-4.60,xmax:-66.00,ymax:13.0,spatialReference:{wkid:4686}})
});
var dynamicMSLayer = new ArcGISDynamicMapServiceLayer("https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer");
map.addLayer(dynamicMSLayer);
});
</script>
</head>

<body>
<div id="map"></div>
</body>
</html>