1

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?

ΩmegaMan
  • 29,542
  • 12
  • 100
  • 122
Loko
  • 6,539
  • 14
  • 50
  • 78

2 Answers2

1

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);
azmuhak
  • 964
  • 1
  • 11
  • 31
  • I am getting an error at the Client parts and MyMap doesn't exist in the current content – Loko Oct 23 '13 at 13:06
  • Sorry, I wrote myMap instead of MyMap. Try now. – azmuhak Oct 23 '13 at 13:19
  • As for error at client parts, Please install ESRI API for WPF (if you are working in C#) in your system and then add service reference of ESRI.ArcGIS.Client and ESRI.ArcGIS.Client.Toolkit.DataSources and ESRI.ArcGIS.Client.Toolkit to your project – azmuhak Oct 23 '13 at 13:21
0

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

paramosh
  • 2,258
  • 1
  • 15
  • 23