I have two independently created shapefiles

A) shapefile 1 lists the german postal codes and can be downloaded from https://blog.oraylis.de/2010/05/german-map-spatial-data-for-plz-postal-code-regions/ 'plotting' will create a map with postal codes as polygons.

B) shapefile 2 (PolygonSamples.shp) contains a list of polygons which are distributed all over Germany. The created polygons might be smaller, equal or larger than the polygon of a single postal codes polygon.

How to 'match' the two shapefiles to get a dataframe that lists which polygon in shapefile 2 matches which postal codes(s) of shapefile 2?

The result would ideally look like:

 Polygon ID (shapefile 2)     Postal Code (shapefile 1)
     1                                80995
     2                                80997
     2                                80999
     3                                81247

The polygon shapefile was created in GeoMap. Not very commonly used unfortunately. I can open it in QGIS desktop, alas whatever I try in QGIS (join, etc) - saved files will always be empty.

  • Do you mean, "which polygon in shapefile 2 matches which postal codes(s) of shapefile 1?"?
    – artwork21
    May 5 '16 at 12:18

thanks to Devdatta Tengshe EPSG 3857 or 4326 for GoogleMaps, OpenStreetMap and Leaflet

i could figure out how to match the two independent shapefiles in QGIS

The main problem: The custom shapefile uses in the .prj file the geocoding Google Mercator (EPSG = 900913), while the downloaded postal code shapefile uses EPSG 4326.

QGIS does not automatically recognize these .prj files as projection files. One has to set them by hand.

Most importantly: Google Mercator (EPSG = 900913) was changed to EPSG= 3857. So for the custom shapefile I had to set – by hand! – the CRS to WGS 84/Pseudo-Mercator EPSG = 3857.

Now I could right click on the custom shape layer -> save as …. And Change the CRS to EPSG 4326. Thus the new custom shapefile now has the same projection like the downloaded postal code shapefile, and they can be joined by location. Voila!

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.