Select to view content in your preferred language

Some simple things are very difficult...why?

773
2
06-16-2011 11:50 AM
KevinKing
Emerging Contributor
I've been working with ESRI maps with Silverlight for a little while, and I've been banging my head against the wall on some VERY simple actions that should be much more intuitive.

I'll list my questions, and perhaps I'm just making things more difficult than they should be.

- Center map on a specific lat/long
- Zoom to a specific zoom resolution

In the Bing Maps Silverlight user control there are:

MyMap.Center = new Location(lat, long);
MyMap.Zoom = 5;

My other question is why are extents, spacial references and other weird ideas SO restrictive? What ever happened to just a map?

May come across as snide, but I think I'm just not seeing the forest for the trees here.

Thanks for any replies!

Kevin
0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor
You need to convert LatLon values to MapPoint.
MapPoint center = new MapPoint(Lon, Lat, MyMap.SpatialReference);

You can then use this as center when calling ZoomToResolution so you can center around this point. http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Map~ZoomTo....
0 Kudos
KevinKing
Emerging Contributor
Thank you for the reply!

I am trying this now, but I keep getting thrown to the center of the map (off the coast of Africa). Sometimes, it doesn't even send me there, but off the coast of South America.

Any gotchas around this? I know I've read lots of "off the coast of Africa" talk (0,0 i assume).

Thanks again,

Kevin
0 Kudos