<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Obrigado Jônatan,</p>
    <p>       Perfeita essa função usando getValuesBlocke consegui fazer
      a extração de 10 valores na horizontal à partir de uma coordenada
      arbitrária como xy(-150,80), porém não consigo agora capturar além
      dos valores dos pixel a coordenada central desses pixel pelo
      output dado pela função, poderia me ajudar?</p>
    <p>No meu caso tentei usar a função xyFromCell():</p>
    <p>require(raster); require(sp)<br>
      set.seed(1)<br>
      ## Criando um raster<br>
      r <- raster(nc=10, nr=10)<br>
      r <- setValues(r, round(runif(ncell(r))* 255))<br>
      #Consigo extrair os valores dos pixels de interesse dadas as
      coordenadas centrais dos mesmos<br>
      x     <- c(-150)<br>
      y     <- c(-80)<br>
      p <- data.frame(x,y)<br>
      pontos <- SpatialPoints(p)<br>
      <br>
      p$cel <- cellFromXY(r, pontos)<br>
      p$col <- colFromCell(r, p$cel)<br>
      p$row <- rowFromCell(r, p$cel)<br>
      p<br>
      plot(r)<br>
      text(r)<br>
      points(pontos, pch = 4, col = 2)<br>
      <br>
      library(plyr)<br>
      vals2cols <- ldply(1:nrow(p),<br>
                         function(ir){<br>
                           getValuesBlock(r, <br>
                                          col = p$col[ir], <br>
                                          ncols = 10, <br>
                                          row = p$row[ir],<br>
                                          nrows = 1)<br>
                           <br>
                         }# end fun<br>
      )<br>
               <br>
      df <- data.frame(p, vals2cols)<br>
      df<br>
      <br>
      p.cen <- xyFromCell(r, vals2cols); p.cen<br>
    </p>
    <p>#END-------------------------------------------------------------------------------------------------------<br>
    </p>
    <pre class="moz-signature" cols="72">-- 
======================================================================
Alexandre dos Santos
Proteção Florestal 
IFMT - Instituto Federal de Educação, Ciência e Tecnologia de Mato Grosso
Campus Cáceres
Caixa Postal 244
Avenida dos Ramires, s/n
Bairro: Distrito Industrial 
Cáceres - MT                      CEP: 78.200-000
Fone: (+55) 65 99686-6970 (VIVO) (+55) 65 3221-2674 (FIXO)
<a class="moz-txt-link-abbreviated" href="mailto:e-mails:alexandresantosbr@yahoo.com.br">e-mails:alexandresantosbr@yahoo.com.br</a> 
        <a class="moz-txt-link-abbreviated" href="mailto:alexandre.santos@cas.ifmt.edu.br">alexandre.santos@cas.ifmt.edu.br</a> 
Lattes: <a class="moz-txt-link-freetext" href="http://lattes.cnpq.br/1360403201088680">http://lattes.cnpq.br/1360403201088680</a> 
OrcID: orcid.org/0000-0001-8232-6722   -   ResearcherID: A-5790-2016
Researchgate: <a class="moz-txt-link-abbreviated" href="http://www.researchgate.net/profile/Alexandre_Santos10">www.researchgate.net/profile/Alexandre_Santos10</a>                       
LinkedIn: br.linkedin.com/in/alexandre-dos-santos-87961635
Mendeley:www.mendeley.com/profiles/alexandre-dos-santos6/
======================================================================</pre>
    <div class="moz-cite-prefix">Em 01/02/2017 22:01, Jônatan escreveu:<br>
    </div>
    <blockquote
cite="mid:CAEiHnvOaW0x=mG5SjqcYzZeY4WLh1LwjBcMRu4SQppub8rE2sA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>use a função getValuesBlock do raster.</div>
        <div><br>
        </div>
        <div>require(raster); require(sp)</div>
        <div>set.seed(1)</div>
        <div>## Criando um raster</div>
        <div>r <- raster(nc=10, nr=10)</div>
        <div>r <- setValues(r, round(runif(ncell(r))* 255))</div>
        <div>#Consigo extrair os valores dos pixels de interesse dadas
          as coordenadas centrais dos mesmos</div>
        <div>x     <- c(54,18,54,54)</div>
        <div>y     <- c(27,81,9,63)</div>
        <div>p <- data.frame(x,y)</div>
        <div>pontos <- SpatialPoints(p)</div>
        <div><br>
        </div>
        <div>p$cel <- cellFromXY(r, pontos)</div>
        <div>p$col <- colFromCell(r, p$cel)</div>
        <div>p$row <- rowFromCell(r, p$cel)</div>
        <div>p</div>
        <div>plot(r)</div>
        <div>text(r)</div>
        <div>points(pontos, pch = 4, col = 2)</div>
        <div><br>
        </div>
        <div>library(plyr)</div>
        <div>vals2cols <- ldply(1:nrow(p),</div>
        <div>                   function(ir){</div>
        <div>                     getValuesBlock(r, </div>
        <div>                                    col = p$col[ir], </div>
        <div>                                    ncols = 2, </div>
        <div>                                    row = p$row[ir],</div>
        <div>                                    nrows = 1)</div>
        <div>                     </div>
        <div>                   }# end fun</div>
        <div>)</div>
        <div>         </div>
        <div>df <- data.frame(p, vals2cols)</div>
        <div>df</div>
        <div><br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">2017-01-26 17:43 GMT-02:00 ASANTOS via
          R-br <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:r-br@listas.c3sl.ufpr.br" target="_blank">r-br@listas.c3sl.ufpr.br</a>></span>:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">Prezados
            Membros,<br>
            <br>
                Tenho um raster hipotético r:<br>
            <br>
            require(raster); require(sp)<br>
            <br>
            ## Criando um raster<br>
            r <- raster(nc=10, nr=10)<br>
            r <- setValues(r, round(runif(ncell(r))* 255))<br>
            <br>
                 Consigo extrair os valores dos pixels de interesse
            dadas as coordenadas centrais dos mesmos:<br>
            <br>
            x     <- c(54,18,54,54)<br>
            y     <- c(27,81,9,63)<br>
            <br>
            pontos <- SpatialPoints(cbind(x,y))<br>
            <br>
            cells <- cellFromXY(r, pontos); cells<br>
            p.cen <- xyFromCell(r, cells); p.cen<br>
            <br>
            values <- extract(r,p.cen)<br>
            dados<-cbind(p.cen,cells,value<wbr>s)<br>
            <br>
                    No entanto, eu gostaria de encontrar um modo para
            extrair o valor dos pixels, no qual, eu selecionaria uma
            coordenada e a função realizaria a extração dos pixels de
            linhas verticais inteiras do raster a cada dois pixels à
            partir da coordenada dada, por exemplo?<br>
            <br>
            Alguém poderia me dar uma ideia de como chegar a esse
            resultado?<br>
            <br>
            Obrigado,<br>
            <br>
            -- <br>
            ==============================<wbr>==============================<wbr>==========<br>
            Alexandre dos Santos<br>
            Proteção Florestal<br>
            IFMT - Instituto Federal de Educação, Ciência e Tecnologia
            de Mato Grosso<br>
            Campus Cáceres<br>
            Caixa Postal 244<br>
            Avenida dos Ramires, s/n<br>
            Bairro: Distrito Industrial<br>
            Cáceres - MT                      CEP: 78.200-000<br>
            Fone: <a moz-do-not-send="true"
              href="tel:%28%2B55%29%2065%2099686-6970"
              value="+5565996866970" target="_blank">(+55) 65 99686-6970</a>
            (VIVO) <a moz-do-not-send="true"
              href="tel:%28%2B55%29%2065%203221-2674"
              value="+556532212674" target="_blank">(+55) 65 3221-2674</a>
            (FIXO)<br>
            <a moz-do-not-send="true"
              href="mailto:e-mails%3Aalexandresantosbr@yahoo.com.br"
              target="_blank">e-mails:alexandresantosbr@yaho<wbr>o.com.br</a><br>
                    <a moz-do-not-send="true"
              href="mailto:alexandre.santos@cas.ifmt.edu.br"
              target="_blank">alexandre.santos@cas.ifmt.edu.<wbr>br</a><br>
            Lattes: <a moz-do-not-send="true"
              href="http://lattes.cnpq.br/1360403201088680"
              rel="noreferrer" target="_blank">http://lattes.cnpq.br/13604032<wbr>01088680</a><br>
            OrcID: <a moz-do-not-send="true"
              href="http://orcid.org/0000-0001-8232-6722"
              rel="noreferrer" target="_blank">orcid.org/0000-0001-8232-6722</a> 
             -   ResearcherID: A-5790-2016<br>
            Researchgate: <a moz-do-not-send="true"
              href="http://www.researchgate.net/profile/Alexandre_Santos10"
              rel="noreferrer" target="_blank">www.researchgate.net/profile/A<wbr>lexandre_Santos10</a><br>
            LinkedIn: <a moz-do-not-send="true"
              href="http://br.linkedin.com/in/alexandre-dos-santos-87961635"
              rel="noreferrer" target="_blank">br.linkedin.com/in/alexandre-d<wbr>os-santos-87961635</a><br>
            Mendeley:<a moz-do-not-send="true"
              href="http://www.mendeley.com/profiles/alexandre-dos-santos6/"
              rel="noreferrer" target="_blank">www.mendeley.com/prof<wbr>iles/alexandre-dos-santos6/</a><br>
            ==============================<wbr>==============================<wbr>==========<br>
            <br>
            ______________________________<wbr>_________________<br>
            R-br mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:R-br@listas.c3sl.ufpr.br" target="_blank">R-br@listas.c3sl.ufpr.br</a><br>
            <a moz-do-not-send="true"
              href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br"
              rel="noreferrer" target="_blank">https://listas.inf.ufpr.br/cgi<wbr>-bin/mailman/listinfo/r-br</a><br>
            Leia o guia de postagem (<a moz-do-not-send="true"
              href="http://www.leg.ufpr.br/r-br-guia" rel="noreferrer"
              target="_blank">http://www.leg.ufpr.br/r-br-g<wbr>uia</a>)
            e fornea cdigo mnimo reproduzvel.</blockquote>
        </div>
        <br>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        <div class="gmail_signature" data-smartmail="gmail_signature">
          <div dir="ltr">
            <div>
              <div dir="ltr">
                <div>
                  <div dir="ltr">
                    <div><font style="font-family:arial" size="2">###############################################################</font><br>
                      <span style="font-family:arial;font-size:small">##
                         </span><span
style="font-size:11px;text-align:center;background-color:rgb(239,239,239);color:rgb(150,150,150);font-family:Verdana,Arial,Helvetica,sans-serif;line-height:13px">Jônatan
                        Dupont Tatsch</span></div>
                    <div><span style="font-family:arial;font-size:small">##
                         </span><span
style="color:rgb(150,150,150);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:10.909090995788574px;line-height:12.997159004211426px;text-align:center;background-color:rgb(239,239,239)">Professor
                        do Departamento de Física</span></div>
                    <div><span style="font-size:small;font-family:arial">##
                         </span><span
style="color:rgb(150,150,150);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:10.909090995788574px;line-height:12.997159004211426px;text-align:center;background-color:rgb(239,239,239)">Centro
                        de Ciências Exatas e Naturais (CCNE)</span><br>
                    </div>
                    <div><span style="font-size:small;font-family:arial">##
                         </span><span
style="color:rgb(150,150,150);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:10.909090995788574px;line-height:12.997159004211426px;text-align:center;background-color:rgb(239,239,239)">Universidade
                        Federal de Santa Maria - UFSM</span></div>
                    <div><span style="font-family:arial;font-size:small">##
                         </span><span
style="font-size:11px;text-align:center;background-color:rgb(239,239,239);color:rgb(150,150,150);font-family:Verdana,Arial,Helvetica,sans-serif;line-height:13px">Faixa
                        de Camobi, Prédio 13 - Campus UFSM - </span><span
style="font-size:11px;text-align:center;background-color:rgb(239,239,239);color:rgb(150,150,150);font-family:Verdana,Arial,Helvetica,sans-serif;line-height:13px">Santa
                        Maria, RS, Brasil - 97105-900</span><br>
                    </div>
                    <div style="font-family:arial;font-size:small">##  <span
style="font-size:11px;text-align:center;background-color:rgb(239,239,239);color:rgb(150,150,150);font-family:Verdana,Arial,Helvetica,sans-serif;line-height:13px">Telefone:
                        +55(55)33012083</span><br>
                    </div>
                    <div style="font-family:arial;font-size:small">##  <span
style="font-size:11px;text-align:center;background-color:rgb(239,239,239);color:rgb(150,150,150);font-family:Verdana,Arial,Helvetica,sans-serif;line-height:13px"><a
                          moz-do-not-send="true"
                          href="http://www.ufsm.br/meteorologia"
                          target="_blank">www.ufsm.br/meteorologia</a></span></div>
                    <div style="font-family:arial;font-size:small">###############################################################</div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>