<div dir="ltr"><div>Thanks Lars and Nicolas,<br></div>The windows option is simple and do exactly what I wanted. thanks.<br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Juli<div><span style="color:rgb(51,51,153)">--</span><br><font color="#333399"><b>CIDE, CSIC</b>  |  <a href="http://www.uv.es/jgpausas" target="_blank">www.uv.es/jgpausas</a>  |  <a href="http://jgpausas.blogs.uv.es/" target="_blank">blog</a><br><br></font></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Wed, Mar 15, 2017 at 5:42 PM, Nicolas Ribot <span dir="ltr"><<a href="mailto:nicolas.ribot@gmail.com" target="_blank">nicolas.ribot@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>You could use a windows function to generate ids for the points:</div><div><br></div><div><span style="font-size:12.8px">SELECT  geom, row_number() over () as code </span></div><div><span style="font-size:12.8px">FROM juli.savannaswdsp</span></div><div><span style="font-size:12.8px">group by geom; </span><br></div><div><br></div><div>Nicolas</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On 15 March 2017 at 15:49, juli g. pausas <span dir="ltr"><<a href="mailto:juli.g.pausas@uv.es" target="_blank">juli.g.pausas@uv.es</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div>Hi<br></div>I have a table with 945361 rows but the geometry (points) are distinct for 201606 locations (i.e., some rows refer to the same point in the space).<br><div><br>SELECT count(*) FROM juli.savannaswdsp;                           -- 945361<br>SELECT  count(DISTINCT geom) FROM juli.savannaswdsp;   -- 201606<br><br><div>Would it be possible to generate a column with codes for the points? that is, like an ID for each point instead for each row (e.g., from 1 to 201606), so rows with the same geom have the same code. <br><br></div><div>[ In R language this would be as follows: as.numeric(as.factor(geom))  ]<br></div><div><br></div><div>Thank for any suggestion<br></div><div><br clear="all"><div><div class="m_1609102669965169478m_-3661490893281016432gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Juli<div><span style="color:rgb(51,51,153)">--</span><br><font color="#333399"><b>CIDE, CSIC</b>  |  <a href="http://www.uv.es/jgpausas" target="_blank">www.uv.es/jgpausas</a>  |  <a href="http://jgpausas.blogs.uv.es/" target="_blank">blog</a><br><br></font></div></div></div></div></div></div></div></div>
</div></div></div>
<br></div></div>______________________________<wbr>_________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailma<wbr>n/listinfo/postgis-users</a><br></blockquote></div><br></div>
<br>______________________________<wbr>_________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/postgis-users</a><br></blockquote></div><br></div>