私のGoogleマップAPIは、マーカーが別の場所を指している間、大西洋の地図をロードします。
コードを確認しました。緯度と経度の座標は正しく、地図上にマークされています。
誰かがこれについて私を助けることができますか?
Dim GeoLatitude As Double
Dim GeoLongitude As Double
Dim GoogleGeoCoderKey As String = keyvar
Dim GoogleResult1 As GoogleResult
GoogleResult1 = GoogleGeocoder.Geocode("streetname, PC City", GoogleGeoCoderKey) 'CurrentPage.PageName & " " & CurrentPage.BodyLeft
If GoogleResult1.Status = GeocodeStatus.G_GEO_SUCCESS Then
If GoogleResult1.Locations.Count = 1 Then
For Each loc As Location In GoogleResult1.Locations()
Dim latOld As String = loc.Point.Latitude.ToString()
GeoLatitude = loc.Point.Latitude ' latOld.Replace(",", ".")
Dim lonOld As String = loc.Point.Longitude.ToString()
GeoLongitude = loc.Point.Longitude 'lonOld.Replace(",", ".")
Next
End If
End If
GoogleMap1.Width = 628
GoogleMap1.Height = 300
GoogleMap1.GoogleKey = keyvar
GoogleMap1.Latitude = GeoLatitude
GoogleMap1.Longitude = GeoLongitude
GoogleMap1.Zoom = 15
GoogleMap1.Options.MapTypes.Add(New Reimers.Map.CustomMaps.GoogleNormalMap())
Dim tm As New Reimers.Map.CustomMaps.GoogleNormalMap()
GoogleMap1.DefaultMap() = tm
GoogleMap1.MapControls.Clear()
GoogleMap1.MapControls.Add(New Reimers.Map.Controls.GoogleLargeMapControl("smc"))
If SubPagePartValue.SmallText1 <> "" And SubPagePartValue.SmallText2 <> "" Then
GeoLatitude = CDbl(SubPagePartValue.SmallText1)
GeoLongitude = CDbl(SubPagePartValue.SmallText2)
End If
If GeoLatitude = 0 Or GeoLongitude = 0 Then
GoogleResult1 = GoogleGeocoder.Geocode(SubPages.BodyLeft, GoogleGeoCoderKey)
If GoogleResult1.Status = GeocodeStatus.G_GEO_SUCCESS Then
If GoogleResult1.Locations.Count = 1 Then
For Each loc As Location In GoogleResult1.Locations()
Dim latOld As String = loc.Point.Latitude.ToString()
GeoLatitude = loc.Point.Latitude
Dim lonOld As String = loc.Point.Longitude.ToString()
GeoLongitude = loc.Point.Longitude
SubPagePartValue.SmallText1 = GeoLatitude
SubPagePartValue.SmallText2 = GeoLongitude
SubPagePartValue.Save()
Next
End If
End If
End If
Dim HTMLCode As String
Dim gm As GoogleMarker = New GoogleMarker(SubPages.PageID)
gm.Point.Latitude = GeoLatitude
gm.Point.Longitude = GeoLongitude
HTMLCode = "<div class=""GoogleMapsPopUp""><h1 class=""GoogleMapsPopUp"">" & SubPages.PageName & "</h1>"
HTMLCode = HTMLCode & "<p class=""text""><a href=""" & SubPages.SEOURL(1) & """ title=""" & SubPages.SEOTitleTagLink & """>" & SubPages.PageName & "</a></p><p>" & SubPages.BodyLeft & "</p></div>"
gm.MarkerText = HTMLCode
gm.ClientSideHandlers.OnInfoWindowOpen = GoogleMap1.PanTo(gm.Point)
gm.ClientSideHandlers.OnClick = gm.OpenInfoWindowHTML(GoogleMap1, gm.MarkerText)
'gm.Options.Icon = SailpointIcon
gm.Options.Title = Replace(SubPages.PageName, "'", "")
GoogleMap1.Overlays.Add(gm)
End If
Next
実際の結果は次のサイトで見ることができます: http://www.stripdagenhaarlem.nl/Programma-Stripdagen-Haarlem.html?cb=Tマップをズームアウトすると、マーカーが正しく配置されていることがわかります。ただし、マップは間違った場所にズームし続けます。