Trying to set the initial extent of map with same extent of a existing Feature Layer.
Code:
var featureLayer = new FeatureLayer("http://server/arcgis/rest/services/MyService/0", {
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ["*"]
});
featureLayer.on("load", function(e) {
var initialExtent = featureLayer.fullExtent;
map = new Map('map-view', {
basemap: "streets",
extent: initialExtent
});
}
This don't work, and I have the following error on console:
Map: Geometry (wkid: 31982) cannot be converted to spatial reference of the map (wkid: 102100)
The Feature Layer was using the Spatial Reference wkid 31982.
Why the map have the Spatial Reference wkid 102100?
This is the only feature layer existing on code, and I "loaded" the Feature Layer before initialize the map, so, until I initialize the map, map = null
What I need to do for the map start up with the same extent of the feature layer?