POST
|
Ok, so I think I've understood where is the problem. When I create a point, I send two parameters in latitude and longitude format, but when I want to zoom or to pan, it's not the same format, and this is the problem. So, I'm trying to search a way to convert this format into the latitude and longitude format, somebody know if it's possible and how realize it ? (I don't very understand how SpatialReference work...)
... View more
07-08-2016
01:00 AM
|
0
|
1
|
410
|
POST
|
Thanks for your reply, Nothing happens when i send my MapPoint Location to ZoomTo() And I have test on another project with button (With the sample), and I realize that when i make that : private void _zoomTo(object sender, RoutedEventArgs e)
{
MapPoint PointTest = new MapPoint(100, 100, MyMap.SpatialReference);
MyMap.PanTo(PointTest);
} The result is always on the point 0,0, at the equator (With PanTo and ZoomTo). I don't very like Silverlight, but I can't do otherwise, it's for my work...
... View more
07-07-2016
12:31 PM
|
0
|
3
|
410
|
POST
|
Hi I'm new on ArcGIS ESRI, so sorry for my question : I try to zoom on a MapPoint but nothing run. I've try the "CenterAndZoom" method and the ZoomTo(new Envelope(...)). This is my code : private void _mapLoad(object sender, RoutedEventArgs e)
{
GraphicsLayer gLayer = MyMap.Layers["G_LAYER"] as GraphicsLayer;
if (gLayer == null)
{
gLayer = new GraphicsLayer(){ ID = "gLayer" };
MyMap.Layers.Add(gLayer);
Graphic marker = new Graphic();
marker.Symbol = new SimpleMarkerSymbol();
gLayer.Graphics.Add(marker);
}
MapPoint location = new MapPoint(46.780764, 4.853947000000062, MyMap.SpatialReference);
gLayer.Graphics[0].Geometry = ESRI.ArcGIS.Client.Bing.Transform.GeographicToWebMercator(location);
Envelope envFullExtent = gLayer.FullExtent;
MyMap.ZoomTo(envFullExtent);
MyMap.PanTo(location);
//MyMap.ZoomTo(new Envelope(location.X - 100, location.Y - 100, location.X + 100, location.Y + 100));
//_centerAndZoom(MyMap, location, MyMap.Resolution);
}
//private void _centerAndZoom(Map map, MapPoint mapPoint, double resolution)
//{
// double ratio = 1.0;
// if (map.Resolution != 0.0)
// {
// ratio = resolution / map.Resolution;
// }
// if (ratio == 1.0)
// {
// map.PanTo(mapPoint);
// }
// else
// {
// MapPoint mapCenter = map.Extent.GetCenter();
// double X = (mapPoint.X - ratio * mapCenter.X) / (1 - ratio);
// double Y = (mapPoint.Y - ratio * mapCenter.Y) / (1 - ratio);
// map.ZoomToResolution(resolution, new MapPoint(X, Y));
// }
//} With the "CenterAndZoom" method, I have a "NullReferenceException" on the "map.Extent.GetCenter();" (l. 43) and for the "MyMap.ZoomTo(new Envelope(location.X - 100, location.Y - 100, location.X + 100, location.Y + 100));", I have a blank page with my point in the left up corner. For the "ZoomTo" with "PanTo", nothing. Please, can you bring me your help ? Thanks to you
... View more
07-07-2016
08:25 AM
|
0
|
5
|
2494
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|