尝试下载空间多边形数据框时,HTTP状态为“ 403禁止”

时间:2019-10-07 08:31:04

标签: r maps r-raster

我有一个包含三个变量的数据集,包括纬度,经度和一个连续变量( Heart_Disease_Ratio(HDR))。该数据集的每一行都与伊朗的一个省有关。我想在 R 中创建伊朗的国家地图,并根据 HDR 变量为其省上色。但是当我想使用 getData()函数下载世界的spacepolygondataframe时,它返回状态403错误:

Private Sub ButtonX1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        Try
            Dim totalResultEng As Int16 = 0
            Dim totalResultFr As Int16 = 0
            Dim time As Int16 = 0
            frmSavingData.Show()
            For i As Integer = 0 To Me.DataGridView1.RowCount - 1
                If Me.DataGridView1.Rows(i).Cells(2).Value = "Polynucléaires neutrophiles" Or Me.DataGridView1.Rows(i).Cells(2).Value = "Polynucléaires éosinophiles" Or _
                    Me.DataGridView1.Rows(i).Cells(2).Value = "Polynucléaires basophiles" Or Me.DataGridView1.Rows(i).Cells(2).Value = "Lymphocytes" Or _
                   Me.DataGridView1.Rows(i).Cells(2).Value = "Monocytes" Then
                    totalResultEng = totalResultEng + Val(Me.DataGridView1.Rows(i).Cells(4).Value)
                    totalResultFr = totalResultFr + Val(Me.DataGridView1.Rows(i).Cells(3).Value)
                    time = time + 1
                End If
            Next
            If totalResultEng <> 100 And time = 5 Then
                MsgBox("Please Check English Resultn Of Test Hg !", MsgBoxStyle.OkOnly, "Total Result")
                Exit Sub
            End If
            If totalResultFr <> 100 And time = 5 Then
                MsgBox("Please Check French Result Of Test Hg !", MsgBoxStyle.OkOnly, "Total Result")
                Exit Sub
            End If
            Dim cmd As MySqlCommand, bold As Integer = 0, checkprint As Int16 = 0
            Dim testNamebox As New RichTextBox
            testNamebox.Width = 500
            testNamebox.Height = 50
            For i As Integer = 0 To Me.DataGridView1.RowCount - 1
                Dim fr_result As String
                Dim eng_result As String
                cmd = New MySqlCommand("select testName from Testdetail where testid =" & Me.DataGridView1.Rows(i).Cells(2).Tag, Setting.cn)
                ' cmd = New MySqlCommand("select testName from Testdetail where testid ='" & Me.DataGridView1.Rows(i).Cells(2).Tag & "'", Setting.cn)
                testNamebox.Text = cmd.ExecuteScalar()
                If testNamebox.Lines.GetUpperBound(0) > 0 Then  'control number of lines in RichTextBox
                    testNamebox.Text = Me.DataGridView1(3, i).Value.ToString
                    If testNamebox.Lines.GetUpperBound(0) > 0 Then
                        If IsNothing(Me.DataGridView1(4, i).Value) Then eng_result = "" Else eng_result = Me.DataGridView1(4, i).Value.ToString
                        If IsNothing(Me.DataGridView1(3, i).Value) Then fr_result = "" Else fr_result = Me.DataGridView1(3, i).Value.ToString
                    Else
                        If IsNothing(Me.DataGridView1(4, i).Value) Then eng_result = "" Else eng_result = "" + vbCrLf + Me.DataGridView1(4, i).Value.ToString
                        If IsNothing(Me.DataGridView1(3, i).Value) Then fr_result = "" Else fr_result = "" + vbCrLf + Me.DataGridView1(3, i).Value.ToString
                    End If
                Else
                    If IsNothing(Me.DataGridView1(4, i).Value) Then eng_result = "" Else eng_result = Me.DataGridView1(4, i).Value.ToString
                    If IsNothing(Me.DataGridView1(3, i).Value) Then fr_result = "" Else fr_result = Me.DataGridView1(3, i).Value.ToString
                End If

                If Me.DataGridView1(7, i).Value = True Then bold = 1
                If Me.DataGridView1(8, i).Value = True Then checkprint = 1
                cmd = New MySqlCommand("Update invoicedetail set EngResult='" & _
                                            eng_result.ToString.Replace("\", "\\").Replace("'", "''") & "', FrResult='" & fr_result.ToString.Replace("\", "\\").Replace("'", "''") & _
                                            "',Bold='" & bold & "',checkprint='" & checkprint & "' where testid='" & Me.DataGridView1.Rows(i).Cells(2).Tag & "' and invoiceid='" & Me.DataGridView1.Rows(i).Cells(0).Tag & "'", Setting.cn)
                cmd.ExecuteNonQuery()
                If Me.DataGridView1.Rows(i).Cells(0).Value <> "" And Me.DataGridView1.Rows(i).Cells(8).Value = False Then
                    cmd = New MySqlCommand("Update invoicedetail set checkprint=0 where  TestID = '" & Me.DataGridView1.Rows(i).Cells(2).Tag & "' and invoiceid='" & Me.DataGridView1.Rows(i).Cells(0).Tag & "'", Setting.cn)
                    cmd.ExecuteNonQuery()
                ElseIf Me.DataGridView1.Rows(i).Cells(0).Value <> "" And Me.DataGridView1.Rows(i).Cells(8).Value = True Then
                    cmd = New MySqlCommand("Update invoicedetail set checkprint=1 where  TestID = '" & Me.DataGridView1.Rows(i).Cells(2).Tag & "' and invoiceid='" & Me.DataGridView1.Rows(i).Cells(0).Tag & "'", Setting.cn)
                    cmd.ExecuteNonQuery()
                End If
                cmd.Dispose()
                bold = 0
                checkprint = 0
                frmSavingData.Refresh()
            Next
            cmd = New MySqlCommand("Update invoicedetail set  EngObservation=" & IIf(txtEnglishObservation.Text <> "", "'" & txtEnglishObservation.Rtf.Replace("'", "''").Replace("\", "\\") & "'", "NULL") & _
                                           ", FrObservation=" & IIf(txtFrenchObservation.Text <> "", "'" & txtFrenchObservation.Rtf.Replace("'", "''").Replace("\", "\\") & "'", "NULL") & _
                                           " where testid='" & TestIDforupdate & "' and invoiceid='" & InvoiceNo & "'", Setting.cn) 'TestID
            cmd.ExecuteNonQuery()
            cmd.Dispose()
            '' MsgBox("Save successed!")
            'Me.Close()
            frmSavingData.Dispose()
        Catch ex As Exception
            frmSavingData.Dispose()
            MsgBox(ex.Message)
        End Try
    End Sub

当我尝试在浏览器中运行url时,也会发生同样的事情。

如果有人可以帮助我在 R 中做到这一点,我将非常感激!

更新
我的问题解决了。

1 个答案:

答案 0 :(得分:0)

问题似乎出在服务器https://biogeo.ucdavis.edu上,而不是光栅本身。希望可以尽快解决