Select to view content in your preferred language

NullReferenceException when I try to ZoomTo

1514
2
Jump to solution
03-13-2014 08:09 AM
Labels (1)
Cristian_Galindo
Frequent Contributor
DEAR PEOPLE FROM THE FUTURE: Here's what we've figured out so far???

I have created an ArcGISLocalFeatureLayer with a different spatial reference from the base layer, then I create a polyline that is added to the Graphics container of the layer.

As my data is in another spatial reference, I remove the layers from the map, change the spatial reference of the map and add the layers again.

then i try to perform ZoomTo using the geometry of the polyline and get this:

System.NullReferenceException was unhandled   HResult=-2147467261   Message=Object reference not set to an instance of an object.   Source=ESRI.ArcGIS.Client   StackTrace:        at ESRI.ArcGIS.Client.Map.getFullViewExtent()        at ESRI.ArcGIS.Client.Map.zoomTo(Geometry geom, Boolean skipAnimation)        at ESRI.ArcGIS.Client.Map.ZoomTo(Geometry geom)   InnerException: 


Any Idea???

if i try to make the zoom with mouse whell it works perfectly
0 Kudos
1 Solution

Accepted Solutions
Cristian_Galindo
Frequent Contributor
As i wrote in :

http://forums.arcgis.com/threads/104530-Graphics-get-lost?p=373773&posted=1#post373773

all is based in the layer's lifecycle.....

I must performed the zoom operation when the layer is created, initializated and updated.. if i tried the zoom operation before al these three stages...the exception is thrown, because the full extend is not set

View solution in original post

0 Kudos
2 Replies
DavidLednik
Frequent Contributor
Hi Cristian,

Since it's a dynamic layer you don't really need to worry about spatial reference (unless you have a lot of features  as it's going to be reprojected to what ever spatial reference your map is in.

So the normal scenario is to Add you basemap layer and other layers that you need.
Create and Add your ArcGISLocalFeatureLayer to the map.

When you add features to this layer they should be visible on the map.

Regards,
David
0 Kudos
Cristian_Galindo
Frequent Contributor
As i wrote in :

http://forums.arcgis.com/threads/104530-Graphics-get-lost?p=373773&posted=1#post373773

all is based in the layer's lifecycle.....

I must performed the zoom operation when the layer is created, initializated and updated.. if i tried the zoom operation before al these three stages...the exception is thrown, because the full extend is not set
0 Kudos