I have the following layers:
- Country border
- federal state borders
- cities (located as points)
I would need the following result file (txt or csv..): A column with the name of the city and another with the federal-state in which the city is located.
It would be great if someone could help me (I alredy tried: vector/merge shape files - but does not work).
Answer
You want to join attributes by location. You are joining the polygons attribute data to your points (cities). Your target layer is the layer you will be joining the attributes to, so make that your city shapefile and the join is the stateborders.shp. Select take attributes of nearest record, choose a location to save the output, and hit ok. In that new shapefile will be the your cities and in the attributes will data from the state borders.
- is your city layer
- is your state border layer
- your output shapefile with the joined data
- also note in the output table to keep all records and not only keep matching records.
Here are some tutorials with pics to better explain.
http://www.qgistutorials.com/en/docs/performing_spatial_joins.html
http://maps.cga.harvard.edu/qgis/wkshop/join_spatial.php
http://trendct.org/2015/05/29/tutorial-how-to-merge-data-from-two-different-maps-using-qgis/
https://infogeoblog.wordpress.com/2013/02/18/joining-layers-in-qgis/
No comments:
Post a Comment