<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">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><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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_-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>______________________________<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>