Dear friends,

PLEASE HELP ME....STRUGGLING TO SOLVE THIS ISSUE

I developed one application for showing  googlemap in my silverlight based  
ESRI application based on the code explaining here in this link

http://rexdotnet.blogspot.com/2010/09/use-google-maps-with-arcgis-silverlight.html
 


Everything working perfect except  one problem at the time of zoom and pan 
the map.

When I try to display a polygon on my googlemap,First time it is showing on 
correct location .But when I zoom or pan the map ,polygon is not moving 
with map.After pan the map polygon is showing in another location .


how to solve this issue?

 
*Adding polygon using the following code*

Private Sub AddPolygonGraphics(coordinateString1 As String, Gname As 
String, Gdesc As String)
        Dim graphicsLayer As GraphicsLayer = 
TryCast(MyMap.Layers("MyGraphicsLayer"), GraphicsLayer)

        Dim pointConverter As New PointCollectionConverter()
        Dim pointCollection1 As ESRI.ArcGIS.Client.Geometry.PointCollection 
=      TryCast(pointConverter.ConvertFromString(coordinateString1), 
ESRI.ArcGIS.Client.Geometry.PointCollection)
        Dim polygon1 As New ESRI.ArcGIS.Client.Geometry.Polygon()
        polygon1.Rings.Add(pointCollection1)
        _activeSymbol = TryCast(LayoutRoot.Resources("DefaultFillSymbolT"), 
Symbol)
        Dim graphic As New Graphic() With
            {
                .Geometry = mercator.FromGeographic(polygon1),
                .Symbol = _activeSymbol
            }
        polygon1.SpatialReference = New SpatialReference(4326)
        Dim strhotspot As String = ""
        strhotspot = Trim(Gname)
        If Gdesc <> "" Then
            strhotspot = strhotspot & "," & Trim(Gdesc)
        End If
        graphicsLayer.Graphics.Add(graphic)
        MyMap.ZoomTo(graphicsLayer.FullExtent)
    End Sub



*USING THE BELOW CODE I AM CALLING THE MAP EACH TIME*

Imports ESRI.ArcGIS.Client
Imports ESRI.ArcGIS.Client.Geometry

Public Class GoogleStaticMapLayer
    Inherits DynamicMapServiceLayer
    Private Shared mercator As New 
ESRI.ArcGIS.Client.Projection.WebMercator()

    Private Const cornerCoordinate As Double = 20037508.3427892
    Private Const WKID As Integer = 102100

    Public Sub New()
        MyBase.New()
    End Sub

    Private Property Lods() As Lod()
        Get
            Return m_Lods
        End Get
        Set(value As Lod())
            m_Lods = Value
        End Set
    End Property
    Private m_Lods As Lod()

    Public Overrides Sub Initialize()
        Me.FullExtent = New 
ESRI.ArcGIS.Client.Geometry.Envelope(-cornerCoordinate, -cornerCoordinate, 
cornerCoordinate, cornerCoordinate) With { _
         .SpatialReference = New SpatialReference(WKID) _
        }

        Me.SpatialReference = New SpatialReference(WKID)

        Lods = New Lod(20) {}
        Dim resolution As Double = cornerCoordinate * 2 / 256
        For i As Integer = 0 To Lods.Length - 1
            Lods(i) = New Lod() With { _
              .Resolution = resolution _
            }
            resolution /= 2
        Next

        MyBase.Initialize()
    End Sub

    Public Overrides Sub GetUrl(extent As 
ESRI.ArcGIS.Client.Geometry.Envelope, width As Integer, height As Integer, 
onComplete As DynamicMapServiceLayer.OnUrlComplete)
        Dim geogCenterPoint As MapPoint = Nothing
        Dim mapURL As String = Nothing

        Try
            Dim currentResolution As Double = extent.Width / width
            Dim currentLodIndex As Integer = 0
            Dim requestWidth As Integer = 0
            Dim requestHeight As Integer = 0
            For i As Integer = 0 To Lods.Length - 1
                Dim lod As Lod = Lods(i)
                currentLodIndex = i
                If CInt(lod.Resolution) <= CInt((currentResolution)) Then
                    requestWidth = CInt(extent.Width / lod.Resolution)
                    requestHeight = CInt(extent.Height / lod.Resolution)
                    Exit For
                End If
            Next

            geogCenterPoint = 
TryCast(mercator.ToGeographic(extent.GetCenter()), MapPoint)
            mapURL = 
String.Format("http://maps.google.com/maps/api/staticmap?center={0},{1}&zoom={2}&size={3}x{4}&scale=2&maptype=roadmap&sensor=false&key=AIzaSyDoFucUPlE1lpMxNqc1-cN-dihqGZuLYUw";,
 
geogCenterPoint.Y, geogCenterPoint.X, currentLodIndex, requestWidth, 
requestHeight)
            
        Catch ex As Exception
            Return
        End Try

        onComplete(mapURL, width, height, New 
ESRI.ArcGIS.Client.Geometry.Envelope() With { _
          .XMin = extent.XMin, _
          .YMin = extent.YMin, _
          .XMax = extent.XMax, _
          .YMax = extent.YMax _
        })
    End Sub
End Class


Please help me.It is very urgent...Thank UUUU

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API V2" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-maps-api/-/wORJ06Lia28J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.

Reply via email to