<table cellspacing="0" cellpadding="0" border="0"><tr><td valign="top"><div>Muito obrigado Éder, resolvido!!!!!!</div></td></tr></table>            <div id="_origMsg_">
                <div>
                    <br />
                    <div>
                        <div style="font-size:0.9em">
                            <hr size="1">
                            <b>
                                <span style="font-weight:bold">From:</span>
                            </b>
                            Éder Comunello <comunello.eder@gmail.com>;                            <br>
                            <b>
                                <span style="font-weight:bold">To:</span>
                            </b>
                            ASANTOS <alexandresantosbr@yahoo.com.br>;                                                     <br>
                            <b>
                                <span style="font-weight:bold">Cc:</span>
                            </b>
                            r-br@listas.c3sl.ufpr.br <r-br@listas.c3sl.ufpr.br>;                                                     <br>
                            <b>
                                <span style="font-weight:bold">Subject:</span>
                            </b>
                            Re: [R-br] Conversão de matriz em raster georeferenciado                            <br>
                            <b>
                                <span style="font-weight:bold">Sent:</span>
                            </b>
                            Tue, Jan 19, 2016 1:41:32 PM                            <br>
                        </div>
                            <br>
                            <table cellspacing="0" cellpadding="0" border="0">
                                <tbody>
                                    <tr>
                                        <td valign="top"><div dir="ltr"><div class="gmail_default" style=""><div class="gmail_default"><font face="verdana, sans-serif">Alterando grid para representar centro dos pixels...</font></div><div class="gmail_default"><font face="verdana, sans-serif"><br clear="none"></font></div><div class="gmail_default"><font face="monospace, monospace">###</font></div><div class="gmail_default"><font face="monospace, monospace">## Dados simulados</font></div><div class="gmail_default"><font face="monospace, monospace">dCol <- 3; nCol <- 10</font></div><div class="gmail_default"><font face="monospace, monospace">dLin <- 2; nLin <- 10</font></div><div class="gmail_default"><font face="monospace, monospace">injuria <- matrix(rnorm(nCol*nLin, mean=12), nLin, nCol)</font></div><div class="gmail_default"><font face="monospace, monospace">dim(injuria) </font></div><div class="gmail_default"><font face="monospace,
 monospace"><br clear="none"></font></div><div class="gmail_default"><font face="monospace, monospace">## Coordenadas do grid espaçadas 3 x 2</font></div><div class="gmail_default"><font face="monospace, monospace">p0 <- c(680200,7803300) ### Lower Left</font></div><div class="gmail_default"><font face="monospace, monospace">p1 <- p0 + c(dCol/2, dLin/2)</font></div><div class="gmail_default"><font face="monospace, monospace">grid <- expand.grid(x=seq(p1[1], by=dCol, len=nCol), </font></div><div class="gmail_default"><font face="monospace, monospace">                    y=seq(p1[2], by=dLin, len=nLin))</font></div><div class="gmail_default"><font face="monospace, monospace">plot(grid, asp=T, pch=21)</font></div><div class="gmail_default"><font face="monospace, monospace"><br clear="none"></font></div><div class="gmail_default"><font face="monospace, monospace">require(raster) </font></div><div class="gmail_default"><font
 face="monospace, monospace">r <-raster(injuria, xmn=p0[1], xmx=p0[1]+(nCol*dCol),</font></div><div class="gmail_default"><font face="monospace, monospace">                    ymn=p0[2], ymx=p0[2]+(nLin*dLin), </font></div><div class="gmail_default"><font face="monospace, monospace">                    crs=CRS("+proj=utm +zone=23 +south +datum=WGS84 +units=m +no_defs"))</font></div><div class="gmail_default"><font face="monospace, monospace"><br clear="none"></font></div><div class="gmail_default"><font face="monospace, monospace">plot(r); points(grid, pch=21) </font></div><div class="gmail_default"><font face="monospace, monospace">r</font></div><div class="gmail_default"><font face="monospace, monospace">###</font></div></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font face="arial, helvetica, sans-serif"
 style="font-size:small;"></font><div style="font-family:'trebuchet ms', sans-serif;display:inline;">​</div>================================================<br clear="none">Éder Comunello<div style="font-size:small;"><span style="font-family:arial, helvetica, sans-serif;">PhD Student in Agricultural Systems Engineering (USP/Esalq)</span><br clear="none"></div><div><span style="font-size:small;">Brazilian Agricultural Research Corporation (</span><font face="arial, helvetica, sans-serif" style="font-size:small;">Embrapa)</font><div style="font-size:small;"><font face="arial, helvetica, sans-serif">Dourados, MS, Brazil [</font>22 16.5'S, 54 49.0'W<span style="font-family:arial, helvetica, sans-serif;">]</span></div><div><div><br clear="none"></div><div><br clear="none"></div></div><div style="font-size:small;"><br clear="none"></div></div></div></div></div></div></div></div></div>
<br clear="none"><div class="yqt5153708688" id="yqt82232"><div class="gmail_quote">Em 19 de janeiro de 2016 09:43, ASANTOS <span dir="ltr"><<a rel="nofollow" shape="rect" ymailto="mailto:alexandresantosbr@yahoo.com.br" target="_blank" href="javascript:return">alexandresantosbr@yahoo.com.br</a>></span> escreveu:<br clear="none"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
  
    
  
  <div>
    Muito obrigado Éder,<br clear="none">
    <br clear="none">
          Ficou muito bom mas era quase isso, pois a coordenada do grid1
    deveria marcar o centro do pixel e não os vértices<span class=""><br clear="none">
    </span><pre>-- 
======================================================================
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: <a rel="nofollow" shape="rect">(+55) 65 8132-8112</a> (TIM)   <a rel="nofollow" shape="rect">(+55) 65 9686-6970</a> (VIVO)
<a rel="nofollow" shape="rect" ymailto="mailto:e-mails:alexandresantosbr@yahoo.com.br" target="_blank" href="javascript:return">e-mails:alexandresantosbr@yahoo.com.br</a> 
        <a rel="nofollow" shape="rect" ymailto="mailto:alexandre.santos@cas.ifmt.edu.br" target="_blank" href="javascript:return">alexandre.santos@cas.ifmt.edu.br</a> 
Lattes: <a rel="nofollow" shape="rect" target="_blank" href="http://lattes.cnpq.br/1360403201088680">http://lattes.cnpq.br/1360403201088680</a>
OrcID: <a rel="nofollow" shape="rect" target="_blank" href="http://orcid.org/0000-0001-8232-6722">orcid.org/0000-0001-8232-6722</a> 
Researchgate: <a rel="nofollow" shape="rect" target="_blank" href="https://www.researchgate.net/profile/Alexandre_Santos10">https://www.researchgate.net/profile/Alexandre_Santos10</a>                       
LinkedIn: <a rel="nofollow" shape="rect" target="_blank" href="https://br.linkedin.com/in/alexandre-dos-santos-87961635">https://br.linkedin.com/in/alexandre-dos-santos-87961635</a>
======================================================================
</pre>
    <div><div class="h5"><div>Em 19/01/2016 09:28, Éder Comunello
      escreveu:<br clear="none">
    </div>
    </div></div><blockquote type="cite"><div><div class="h5">
      <div dir="ltr">
        <div class="gmail_default" style="font-family:verdana, sans-serif;">Alexandre, bom dia!</div>
        <div class="gmail_default" style="font-family:verdana, sans-serif;"><br clear="none">
        </div>
        <div class="gmail_default" style="font-family:verdana, sans-serif;">Com seu código eu
          obtenho:</div>
        <div class="gmail_default"><font face="monospace, monospace">>
            res(r)<br clear="none">
          </font></div>
        <div class="gmail_default">
          <div class="gmail_default"><font face="monospace, monospace">[1]
              1.978261 2.823529</font></div>
        </div>
        <div class="gmail_default" style="font-family:verdana, sans-serif;"><br clear="none">
        </div>
        <div class="gmail_default" style="font-family:verdana, sans-serif;">Seria esperado 2 e 3. O
          problema parece estar na forma de associar seu grid com os
          limites do raster.</div>
        <div class="gmail_default" style="font-family:verdana, sans-serif;"><br clear="none">
        </div>
        <div class="gmail_default" style="font-family:verdana, sans-serif;">Sugiro algo assim:</div>
        <div class="gmail_default" style="font-family:verdana, sans-serif;"><br clear="none">
        </div>
        <div class="gmail_default"><font face="monospace, monospace">###</font></div>
        <div class="gmail_default">
          <div class="gmail_default"><font face="monospace, monospace">##
              Dados simulados</font></div>
          <div class="gmail_default"><font face="monospace, monospace">dCol
              <- 3; nCol <- 10</font></div>
          <div class="gmail_default"><font face="monospace, monospace">dLin
              <- 2; nLin <- 10</font></div>
          <div class="gmail_default"><font face="monospace, monospace">injuria
              <- matrix(rnorm(nCol*nLin, mean=12), nLin, nCol)</font></div>
          <div class="gmail_default"><font face="monospace, monospace">dim(injuria) </font></div>
          <div class="gmail_default"><font face="monospace, monospace"><br clear="none">
            </font></div>
          <div class="gmail_default"><font face="monospace, monospace">##
              Coordenadas do grid espaçadas 3 x 2</font></div>
          <div class="gmail_default"><font face="monospace, monospace">p0
              <- c(680200,7803300)</font></div>
          <div class="gmail_default"><font face="monospace, monospace">grid0
              <- expand.grid(x=seq(p0[1], by=dCol, len=nCol),
              y=seq(p0[2], by=dLin, len=nLin))</font></div>
          <div class="gmail_default"><font face="monospace, monospace">grid1
              <- expand.grid(x=seq(p0[1], by=dCol, len=nCol+1),
              y=seq(p0[2], by=dLin, len=nLin+1))</font></div>
          <div class="gmail_default"><font face="monospace, monospace">plot(grid0,
              asp=T, pch=21)</font></div>
          <div class="gmail_default"><font face="monospace, monospace"><br clear="none">
            </font></div>
          <div class="gmail_default"><font face="monospace, monospace">require(raster) </font></div>
          <div class="gmail_default"><font face="monospace, monospace">r
              <-raster(injuria, xmn=p0[1], xmx=p0[1]+(nCol*dCol),</font></div>
          <div class="gmail_default"><font face="monospace, monospace"> 
                                ymn=p0[2], ymx=p0[2]+(nLin*dLin), </font></div>
          <div class="gmail_default"><font face="monospace, monospace"> 
                                crs=CRS("+proj=utm +zone=23 +south
              +datum=WGS84 +units=m +no_defs"))</font></div>
          <div class="gmail_default"><font face="monospace, monospace"><br clear="none">
            </font></div>
          <div class="gmail_default"><font face="monospace, monospace">plot(r);
              points(grid0, pch=21) </font></div>
          <div class="gmail_default"><font face="monospace, monospace">plot(r);
              points(grid1, pch=21) </font></div>
          <div class="gmail_default"><font face="monospace, monospace">r</font></div>
        </div>
        <div class="gmail_default"><font face="monospace, monospace">###</font></div>
        <div class="gmail_default" style="font-family:verdana, sans-serif;"><br clear="none">
        </div>
        <div class="gmail_default" style="font-family:verdana, sans-serif;"><br clear="none">
        </div>
        <div class="gmail_default" style="font-family:verdana, sans-serif;"><br clear="none">
        </div>
        <div class="gmail_default" style="font-family:verdana, sans-serif;"><br clear="none">
        </div>
      </div>
      <div class="gmail_extra"><br clear="all">
        <div>
          <div>
            <div dir="ltr">
              <div>
                <div dir="ltr">
                  <div>
                    <div dir="ltr"><font style="font-size:small;" face="arial, helvetica, sans-serif">
                        </font><div>​</div>
                        ================================================<br clear="none">
                        Éder Comunello
                      <div style="font-size:small;"><span style="font-family:arial, helvetica, sans-serif;">PhD
                          Student in Agricultural Systems
                          Engineering (USP/Esalq)</span><br clear="none">
                      </div>
                      <div><span style="font-size:small;">Brazilian
                          Agricultural Research Corporation (</span><font style="font-size:small;" face="arial,                           helvetica, sans-serif">Embrapa)</font>
                        <div style="font-size:small;"><font face="arial,                             helvetica, sans-serif">Dourados, MS, Brazil
                            [</font>22 16.5'S, 54 49.0'W<span style="font-family:arial, helvetica, sans-serif;">]</span></div>
                        <div>
                          <div><br clear="none">
                          </div>
                          <div><br clear="none">
                          </div>
                        </div>
                        <div style="font-size:small;"><br clear="none">
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <br clear="none">
        <div class="gmail_quote">Em 18 de janeiro de 2016 15:44, ASANTOS
          <span dir="ltr"><<a rel="nofollow" shape="rect" ymailto="mailto:alexandresantosbr@yahoo.com.br" target="_blank" href="javascript:return">alexandresantosbr@yahoo.com.br</a>></span>
          escreveu:<br clear="none">
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Prezados
            Listeiros,<br clear="none">
            <br clear="none">
            <br clear="none">
                         Gostaria de realizar a conversão de uma matriz
            em raster georeferenciado com duas informações, a
            representação de plantas em uma matriz (B) e juntar as
            informações geográficas conhecendo-se o espaçamento entre
            plantas (d1), no entanto, gostaria de saber se conforme o
            meu CRM abaixo essa conversão esta correta, pois não estou
            bem certo de que realização de um cbind() entre os objetos B
            e d1 correspondam a real posição desses elementos. Alguém
            poderia me ajudar?<br clear="none">
            <br clear="none">
            <br clear="none">
            ##Dados artificiais<br clear="none">
            injuria<-rnorm(1550, mean=12)<br clear="none">
            <br clear="none">
            ##Crio a matriz com os dados artificiais<br clear="none">
            B = matrix(<br clear="none">
                data=injuria,<br clear="none">
                nrow=25,<br clear="none">
                ncol=62)<br clear="none">
            <br clear="none">
            # Inserindo coordenadas espaciais<br clear="none">
            p0<-c(680234.482625,7803361.55128)# Ponto inicial<br clear="none">
            c0 <- seq(p0[1],p0[1]+182,by=2)<br clear="none">
            d0 <- seq(p0[2],p0[2]+50,by=3)<br clear="none">
            d1 <- expand.grid(x=c0, y=d0) ## Coordenadas do grid
            espaçadas 3 x 2<br clear="none">
            d1<-d1[-(1:14),] ## Removo algumas corrdenadas para ficar
            com o mesmo número de dados<br clear="none">
            plot(d1[,1],d1[,2])<br clear="none">
            length(d1[,1])<br clear="none">
            <br clear="none">
            require(raster)<br clear="none">
            FORM<-cbind(d1,B)<br clear="none">
            colnames(FORM)<-c('x','y','area')<br clear="none">
            r <- rasterFromXYZ(as.data.frame(FORM)[, c("x", "y",
            "area")])<br clear="none">
            extent(r) <- c(680234.5,680416.5,7803362,7803410)<br clear="none">
            projection(r) <- CRS("+proj=utm +zone=23 +south
            +datum=WGS84 +units=m +no_defs")<br clear="none">
            plot(r)<br clear="none">
            #<br clear="none">
            <br clear="none">
            <br clear="none">
            <br clear="none">
            Obrigado,<br clear="none">
            <br clear="none">
            -- <br clear="none">
======================================================================<br clear="none">
            Alexandre dos Santos<br clear="none">
            Proteção Florestal<br clear="none">
            IFMT - Instituto Federal de Educação, Ciência e Tecnologia
            de Mato Grosso<br clear="none">
            Campus Cáceres<br clear="none">
            Caixa Postal 244<br clear="none">
            Avenida dos Ramires, s/n<br clear="none">
            Bairro: Distrito Industrial<br clear="none">
            Cáceres - MT                      CEP: 78.200-000<br clear="none">
            Fone: <a rel="nofollow" shape="rect">(+55) 65 8132-8112</a>
            (TIM)   <a rel="nofollow" shape="rect">(+55) 65 9686-6970</a>
            (VIVO)<br clear="none">
            <a rel="nofollow" shape="rect" ymailto="mailto:e-mails%3Aalexandresantosbr@yahoo.com.br" target="_blank" href="javascript:return">e-mails:alexandresantosbr@yahoo.com.br</a><br clear="none">
                    <a rel="nofollow" shape="rect" ymailto="mailto:alexandre.santos@cas.ifmt.edu.br" target="_blank" href="javascript:return">alexandre.santos@cas.ifmt.edu.br</a><br clear="none">
            Lattes: <a rel="nofollow" shape="rect" target="_blank" href="http://lattes.cnpq.br/1360403201088680">http://lattes.cnpq.br/1360403201088680</a><br clear="none">
            OrcID: <a rel="nofollow" shape="rect" target="_blank" href="http://orcid.org/0000-0001-8232-6722">orcid.org/0000-0001-8232-6722</a><br clear="none">
            Researchgate: <a rel="nofollow" shape="rect" target="_blank" href="https://www.researchgate.net/profile/Alexandre_Santos10">https://www.researchgate.net/profile/Alexandre_Santos10</a><br clear="none">
            LinkedIn: <a rel="nofollow" shape="rect" target="_blank" href="https://br.linkedin.com/in/alexandre-dos-santos-87961635">https://br.linkedin.com/in/alexandre-dos-santos-87961635</a><br clear="none">
======================================================================<br clear="none">
            <br clear="none">
            _______________________________________________<br clear="none">
            R-br mailing list<br clear="none">
            <a rel="nofollow" shape="rect" ymailto="mailto:R-br@listas.c3sl.ufpr.br" target="_blank" href="javascript:return">R-br@listas.c3sl.ufpr.br</a><br clear="none">
            <a rel="nofollow" shape="rect" target="_blank" href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br clear="none">
            Leia o guia de postagem (<a rel="nofollow" shape="rect" target="_blank" href="http://www.leg.ufpr.br/r-br-guia">http://www.leg.ufpr.br/r-br-guia</a>) e
            fornea cdigo mnimo reproduzvel.</blockquote>
        </div>
        <br clear="none">
      </div>
      <br clear="none">
      <fieldset></fieldset>
      <br clear="none">
      </div></div><pre></pre><div><div class="h5">_______________________________________________
R-br mailing list
<a rel="nofollow" shape="rect" ymailto="mailto:R-br@listas.c3sl.ufpr.br" target="_blank" href="javascript:return">R-br@listas.c3sl.ufpr.br</a>
<a rel="nofollow" shape="rect" target="_blank" href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a></div></div>
Leia o guia de postagem (<a rel="nofollow" shape="rect" target="_blank" href="http://www.leg.ufpr.br/r-br-guia">http://www.leg.ufpr.br/r-br-guia</a>) e forne�a c�digo m�nimo reproduz�vel.
    </blockquote>
    <br clear="none">
  </div>

</blockquote></div></div><br clear="none"></div></td>
                                    </tr>
                                </tbody>
                            </table>
                    </div>
                </div>
            </div>