0

Subgurim's Mapのコントロールの使用を開始しましたASP.NETが、 を に変換する必要がcoordinatesありstringますdatabase

これが私のコードです:

    Protected Sub lnkShowMap_Click(ByVal sender As Object,
    ByVal e As System.EventArgs) Handles lnkShowMap.Click
    Dim strFullAddress As String
    Dim sMapKey As String =
    ConfigurationManager.AppSettings("googlemaps.subgurim.net")
    Dim GeoCode As Subgurim.Controles.GeoCode

    ' Combine our address fields to create the full address.  The street,
    ' suburb and country should be seperated by  periods (.)
    strFullAddress = txtStreetAddress.Text & ". " & txtSuburb.Text & ". " & txtCountry.Text

    ' Work out the longitude and latitude
    GeoCode = GMap1.geoCodeRequest(strFullAddress, sMapKey)
Dim gLatLng As New Subgurim.Controles.GLatLng(GeoCode.Placemark.coordinates.lat,
    GeoCode.Placemark.coordinates.lng)
    ' Display the map
    GMap1.setCenter(gLatLng, 16, Subgurim.Controles.GMapType.GTypes.Normal)
    Dim oMarker As New Subgurim.Controles.GMarker(gLatLng)
    GMap1.addGMarker(oMarker)

    ' Create coordinates in stored mem ' 
    Dim coordinates As GeoCode = GMap1.getGeoCodeRequest(GeoCode.Placemark.coordinates)
    System.Diagnostics.Debug.WriteLine(coordinates)
End Sub

この の最後の 2 行に問題があります。 の結果であるとsub定義していますが、 の値がに起因していないという事実にもかかわらず、'coordinates'Gmap1's placemarker's coordinatesdebuggingGeoCode.Placemark.coordinates'coordinates'

これはのスクリーンショットですdebugging process: http://www.wherelionsroam.co.uk/debug.png

私は何を間違っていますか?

4

1 に答える 1

1

まず第一にGMap1.getGeoCodeRequest()、オブジェクトをパラメーターとして渡すGLatLngと、返される座標が引数として渡したものと同じになるため、ジオコーディング呼び出しが無駄になります。実際、あなたのコードには、必要なものがすべて含まれていますGeoCode.Placemark.coordinates

Dim coordinates as GLatLng = GeoCode.Placemark.coordinates

座標変数には、必要な情報を含むlatおよびlngプロパティがあり、1 回のジオコーディング呼び出しを保存できます (呼び出しは Google によって制限されているため、保存することが重要です)。

于 2013-04-13T09:22:23.340 に答える