I downloaded a UTM32 shapefile (.cpg, .dbf, .prj, .shp, .shx file, where other available georeferences are GK3 and TM32) that shows the exclusive division of Germany in its municipalities. Above, I have a large dataset of subjects with their postal addresses (street, house number, zip code, city).

I would like to assign each subject to exactly one municipality using the postal address. I want the corresponding municipality's id (saved as attribute in the shapefile) to be attached to each subject in my database and export it, say, in a csv file.

However, I am not sure how to combine the shapefile with the addresses. I can imagine two approaches:

  1. Using Nominatim or other services I could geocode the postal addresses, i.e. convert them into lat/long coordinates. Let's assume for a second that I already did.

How can I add coordinate information to the shapefiles in order to achieve the assignment of subjects?

  1. There are also shapefiles for German Streets (Open Street Map etc.). Let's assume I have access to such data.

Is it in principle possible to place the municipality and the street layer on top of each other, locate each address on the street layer and identify the corresponding municipality on this basis?

Which one is practical?

I am using QGIS 2.6 and Mac OS X Yosemite.

closed as too broad by PolyGeo Jul 4 '17 at 21:32

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Yes, geocode then spatial join (assigns polygon attributes to corresponding points). I'm not a QGIS expert, but could help you with ArcGIS. – phloem Feb 7 '15 at 17:56
  • 1
    "GPS" doesn't really have anything to do with it - you're after lat/long coordinates from addresses, which as you point out is Geocoding, and is covered at other questions here. Geocoding usually gives you a point geometry, not just the coordinate pairs, so you'll end up with a point shapefile when the geocoding results are exported. If you did just have coordinate pairs, they can be added (Add Delimited Text) as points, which is also covered at other questions here. – Chris W Feb 7 '15 at 23:25
  • A simple intersect can get your municipality as an attribute of the points - but here, and with the density analysis component, your question is becoming too broad for a single SE question. You should edit your question to narrow the scope and ask separate questions for the different parts. Your #2 is possible, but the streets have to have address ranges, and it become a visual inspection of your points - not terribly efficient. – Chris W Feb 7 '15 at 23:27
  • Thank you for your useful clarification. Let me get this straight: The point geometry that geocoding with leave me with will be "compatible" with the shapefile I refer to in my post? In my understanding that is not self-explaining because shapefiles could also use "self-contained geometry". I did not find any answer to this question yet. Also, as suggested, I excluded the density analysis question from my post to prevent it from becoming too broad. – Jhonny Feb 8 '15 at 11:47
  • @phloem, I don't have access to ArcGIS yet but if I do I might switch to it later on. I appreciate your help and might get back to it. – Jhonny Feb 8 '15 at 11:48
  1. You could geocode the adresses: For example with http://www.gpsvisualizer.com/geocoder/

or the MMQGIS-Plugin:

enter image description here

Then do a spatial join:

enter image description here

enter image description here

And there you have the assigned Municipalities:

enter image description here

For measuring the point density you could count the points per polygon: enter image description here enter image description here

Or use the Heatmap-Tool (Raster --> Heatmap)

  • thank you for your detailed explanation. That's exactly what I want, though for some reason I have zero matches. The problem is not the geocoding - I don't get an error and I can see the geocoded locations as points on the map. I also made sure to specify the geocoded shape file as the target vector layer. Do you have an idea what's wrong? – Jhonny Feb 8 '15 at 15:21
  • 2
    Both shapefiles must have the same crs.so if your geocoded layer has epsg4326 you could transform this layer to your target crs (right-click on the layer, save as... and there you can choose the srs. – Thomas B Feb 8 '15 at 15:26

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