Pergunta

So I am making an add in in C# for arcmap and I got this :

MapPoint myPoint = new MapPoint(500, 500, spatialRef);

MyMap.ZoomTo(myPoint);

from this website: http://forums.arcgis.com/threads/13749-how-to-Zoom-to-point

Since there isn't much information to find on the internet and I am fairly new to ARCGIS I cant figure out my problems that easily so the questions might sound dumb.

I get an error at spatialRef. The spatialRef should be replaced by something but I have no idea what. I also have no idea what to replace MyMap with, and I cant figure out what reference I am missing at MapPoint since I also get an error at that part.

Can someone please explain me what to do?

Foi útil?

Solução

first define your map by:

ESRI.ArcGIS.Client.Map MyMap;

then define your spatial reference

ESRI.ArcGIS.Client.Geometry.SpatialReference _spatialReference = new ESRI.ArcGIS.Client.Geometry.SpatialReference(4269);

the 4269 is the Well Known ID (WKID) of the GCS_North_American_1983 spatial reference/coordinate system. You can choose any WKID. Just choose a number from here.

Then define your map point

MapPoint myPoint = new MapPoint(500, 500, _spatialReference );

and perform ZoomTo

MyMap.ZoomTo(myPoint);

Outras dicas

It should be replaced with object of SpatialReference class, like new SpatialReference(). You also can pass to the constructor WKID.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top