Hi there, whenever I run the code :
layer.then(function(){
view.extent = layer.fullExtent;
});
when layer is a FeatureLayer the full Extent is always null.
Is this a bug or a known issue ( can be tested with the sandbox example FeatureLayer)
Solved! Go to Solution.
The fullExtent of the layer is determined by the service. So someone can publish a layer containing a fullExtent or one without one. If you want to ensure you are zooming to the fullExtent of your data, you can get this on the client by doing the following:
layer.queryExtent()
.then(function(response){
view.goTo(response.extent);
});
That will ensure your view zooms to the extent of all features in the layer whether or not a fullExtent is present on the service.
Is this the example you're referring to? ArcGIS API for JavaScript Sandbox
I see a fullExtent being set properly once the layer has loaded.
My understanding is that fullExtent is not calculated in the client, rather it is passed from the service. I would check your service and make sure it has a fullExtent.
If you're building a featureLayer in the client I doubt fullExtent will be calculated automatically. In this case you may have to calculate it yourself by finding the smallest bounding box that contains all features.
The fullExtent of the layer is determined by the service. So someone can publish a layer containing a fullExtent or one without one. If you want to ensure you are zooming to the fullExtent of your data, you can get this on the client by doing the following:
layer.queryExtent()
.then(function(response){
view.goTo(response.extent);
});
That will ensure your view zooms to the extent of all features in the layer whether or not a fullExtent is present on the service.