Advance thanks to all who are trying to help me here with ur valubale 
time...

In my ESRI based web application ,I integrated Google map based on the link 
below.
http://rexdotnet.blogspot.com/2010/09/use-google-maps-with-arcgis-silverlight.html

Now Google map is showing perfect and zoom ,pan is working correctly when 
the requested height and width is <=640.


When the height or width become higher than this range,The zoom and pan is 
showing in different way -
 and if I add any icon on the map,It is going out of the location after 
zoom and pan the map.

Can Anybody help me to solve this?The code I pasted here with


using System;
> using ESRI.ArcGIS.Client;
> using ESRI.ArcGIS.Client.Geometry;
>
> namespace CustomLayers
> {
>     public class GoogleStaticMapLayer : DynamicMapServiceLayer
>     {
>         private static ESRI.ArcGIS.Client.Projection.WebMercator mercator =
>                 new ESRI.ArcGIS.Client.Projection.WebMercator();
>
>         private const double cornerCoordinate = 20037508.3427892;
>         private const int WKID = 102100;
>
>         public GoogleStaticMapLayer() : base(){ }
>
>         private Lod[] Lods { get; set;}
>         
>         public override void Initialize()
>         {
>             this.FullExtent =
>             new ESRI.ArcGIS.Client.Geometry.Envelope(-cornerCoordinate, 
> -cornerCoordinate, cornerCoordinate, cornerCoordinate)
>             {
>                 SpatialReference = new SpatialReference(WKID)
>             };
>
>             this.SpatialReference = new SpatialReference(WKID);
>             
>             Lods = new Lod[21];
>             double resolution = cornerCoordinate * 2 / 256;
>             for (int i = 0; i < Lods.Length; i++)
>             {
>                 Lods[i] = new Lod() { Resolution = resolution };
>                 resolution /= 2;
>             }
>
>             base.Initialize();
>         }
>
>         public override void GetUrl(ESRI.ArcGIS.Client.Geometry.Envelope 
> extent, int width, int height,
>             DynamicMapServiceLayer.OnUrlComplete onComplete)
>         {
>             MapPoint geogCenterPoint = null;
>             string mapURL = null;            
>             
>             try
>             {
>                 //if (width > 640 || height > 640) 
>                 //    throw new Exception("Width or height greater than 
> 640");
>                 
>                 double currentResolution = extent.Width / width;
>                 int currentLodIndex = 0;
>                 int requestWidth = 0;
>                 int requestHeight = 0;
>                 for (int i = 0; i < Lods.Length; i++)
>                 {
>                     Lod lod = Lods[i];
>                     currentLodIndex = i;
>                     if ((int)lod.Resolution <= (int)currentResolution)
>                     {
>                         requestWidth = (int)(extent.Width / 
> lod.Resolution);
>                         requestHeight = (int)(extent.Height / 
> lod.Resolution);
>                         break;
>                     }
>                 }
>
>                 //if (requestWidth > 640 || requestHeight > 640) 
>                 //    throw new Exception("Request width or height greater 
> than 640");                
>
>                 geogCenterPoint = 
> mercator.ToGeographic(extent.GetCenter()) as MapPoint;
>
>                 mapURL = string.Format
>                   
> ("http://maps.google.com/maps/api/staticmap?center={0},{1}&zoom={2}&size={3}x{4}&maptype=roadmap&sensor=false";,
>                    geogCenterPoint.Y, geogCenterPoint.X, currentLodIndex, 
> requestWidth, requestHeight);
>
>             }
>             catch (Exception ex)
>             {
>                 // Message box just for debug purposes
>                 //System.Windows.MessageBox.Show( ex.Message,"Error: 
> Google Static Map not generated", System.Windows.MessageBoxButton.OK); 
>                 return;
>             }
>
>             onComplete(mapURL, width, height, new 
> ESRI.ArcGIS.Client.Geometry.Envelope()
>             {
>                 XMin = extent.XMin,
>                 YMin = extent.YMin,
>                 XMax = extent.XMax,
>                 YMax = extent.YMax
>             });
>         }      
>     }
> }
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API V2" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to