The imported data did not include coordinates. These can be constructed by creating a centroid for each polygon in the shapefile, converting the projection to wgs84 and exporting the x/lon, y/lat values.
Description
Event Timeline
Steps in Qgis:
- Import polygon shp file
- Vector → Geometry tools → Polygon centroids
- Right click on the new layer → Save As → CRS → WGS84 (EPSG 4326)
- Open the new file and ensure the CRS for the whole view is set to EPSG 4326 (bottom right corner)
- Right click on the layer → Open attribute table → Ctrl-E
- Ctrl-I Set name to "lon", precision to "6", expression to "$x" click "ok"
- Ctrl-I Set name to "lat", precision to "6", expression to "$y" click "ok"
- Ctrl-S → close window
- use e.g. XYtools to extract the nvrid, lon, lat fields as a spreadsheet.
Items with Nature ID without coords.
This script loads the results of the query above and compares it with one of the CSV files in order to output the necessary QS code in a file. Since it runs the query automatically, only WD items that have no coordinate Property will be affected. Items that already have coordinates e.g. from a Wikipedia import will not be affected.
Usage:
python3 qs_wle_coords.py --infile coords_NR.csv --outfile reservat_coords.tsv
--infile : name of one of the two files above
--outfile : name of the file where to save the QS code
The output looks like this and is ready to be used in Quick Statements (import commands -> version 1 format -> run)
Q30169787 P625 @63.6522/16.196913 Q30169901 P625 @59.531262/18.835281 Q30170296 P625 @59.044214/14.513086 Q30171477 P625 @56.173853/14.529247
To ensure the centroids are also inside the polygon i used the realcentroid plugin instead of # Vector → Geometry tools → Polygon centroids.
While the NP centroids where the same this gave me a new set of NR centroids.