Created
December 6, 2021 23:06
-
-
Save akanik/1ba0acd2b02b716348f049b75fd8533e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#create two new columns via attribute table | |
#via: https://gis.stackexchange.com/questions/45243/how-to-determine-the-centroid-of-polygons | |
long = toreal(regexp_substr(geom_to_wkt(centroid($geometry)), '(-?\\d+\\.?\\d*) -?\\d+\\.?\\d*')) | |
lat = toreal(regexp_substr(geom_to_wkt(centroid($geometry)), '-?\\d+\\.?\\d* (-?\\d+\\.?\\d*)')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment