[Qgis-user] Adding xy-coordinates to attribute table

Jorge Tornero - Listas jtorlistas at gmail.com
Tue Mar 25 07:11:15 PDT 2014


I guess you want to create the "3132173127312" string, not to create x 
coordinate and y coordinate from the string, don't you? I guess the 
other answers assumed this, also.

In that case, assuming your coordinates are for instance in WGS84 and 
you want later to recover the info with 6 decimals both in  y (latitude) 
and  x (longitude),  and you would like to  recover the coordinates 
later completely,  this might work:



(case when x <0 then 'W' else 'E' end) || lpad((abs(x)*10^6),9,0)||(case 
when y>0 then 'N' else 'S' end) || lpad((abs(y)*10^6),8,0)


which renders:


W006345645N22987456
W|006|345645|N|22|987456
X hemisphere|x degrees|x decimal degrees|Y hemisphere|y degrees|y 
decimal degrees|


You can play with the exponent and the number of characters to pad to in 
lpad function to get more or less decimals for your coordinates.


Hope this works


Best regards


Jorge Tornero



El 25/03/14 12:19, Simo Turunen escribió:
> Hi all,
>
> Is there a way (from calculator?) to create xycoordinates from point 
> that i created into the same row, that it looks like
> "3186295678893" <-x & y.
>
> -Simo
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20140325/47238dde/attachment.html>


More information about the Qgis-user mailing list