[Qgis-user] Getting lon/lat

Jack Andersen jack.andersen9 at gmail.com
Mon Mar 27 00:30:20 PDT 2017


Hi phi73,
You can get the Lat long for start and endpoints by using the field
calculator in the attribute table.
create a new field and calculate it with the following:
i.g. field "longXstart"  calculate: x(start_point($geometry))
"latYstart" calculate: y(start_point($geometry))

You can do the same for the endpoint by changing start_point with end_point

Furthermore the output will be in the same projection/coordinates as your
layer, but you can do a transform command on the above command with:
x(transform(start_point( $geometry), 'EPSG:25832', 'EPSG:4326')) where the
first epsg code is the current projection and the second one is the target
projection
I have moved the x to the front of the command because the transform
function only works on coodinate sets and i therefore transform x and y and
then extract x.

_Jack Andersen

On Mon, Mar 27, 2017 at 8:17 AM, <phi73 at gmx.de> wrote:

> Hello
>
> i have map based on vector data and in it some street elements.
> I would like to pick up a line segment and get the lon/lat for
> the start vertex and end vertex.
> How could it be done the easiest way in QGIS.
>
> thanks
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20170327/a09fa56a/attachment.html>


More information about the Qgis-user mailing list