1

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).

  • How does it not work? What have you tried so far? – John Powell Feb 12 '16 at 21:10
1

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.

enter image description here

  1. is your city layer
  2. is your state border layer
  3. 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/

2

Use the "Join Attributes by Location" in the Vector menu for your cities and federal state layers, select to keep all attributes, then with the result shapefile, use "Save As" and select to save it as csv.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.