[Qgis-user] python(3) script to calculate latitude longitude values from (ESRI) shape file

Nyall Dawson nyall.dawson at gmail.com
Wed Apr 21 18:24:30 PDT 2021


On Thu, 22 Apr 2021 at 06:43, wxgis <thinjogger at gmail.com> wrote:
>
> Hi -
> Wondering if there is existing Python(3) script code that can take an (ESRI)
> shape file as input and then calculate latitude/longitude/elevation values
> for country boundaries.  For example, if the input file is a SHP file for
> France, the output would be the lat/lon/elevation values for the country
> boundaries.  I am quite new to QGIS, looking at version 3.18 (so only know
> about ESRI shape files, maybe there are other types of SHP files?), and read
> that in QGIS  I can edit the attribute table for a given layer and add
> latitude/longitude attributes, but I am hoping to this more
> programmatically, using the QGIS Python console.  I gladly welcome any ideas
> on this.

If you're new to this then I'd suggest skipping the Python part and
instead making a graphical model using Processing tools to do what you
want. The visual aspect of making models will help guide you through
the process, and there's plently of video tutorials on Youtube showing
how to do this.

You can even then take the model and automatically convert it directly
to a Python script with a single button click!

Hope that helps,
Nyall


More information about the Qgis-user mailing list