I have a shapefile from the Census Bureau on Zip Code Tabulation Areas (http://www.census.gov/cgi-bin/geo/shapefiles/index.php). I wanted to get, for each zip code, the list of neighboring zip codes.
More specifically, I would like to export a file that gives a dataset of the form,
ZIPCODE,NEIGHBOR1,NEIGHBOR2,NEIGHBOR3,NEIGHBOR4
90001,90002,90010,.,.
60640,60660,60625,60613,60618
So for each zip code, there would be columns which would be populated with neighboring zip codes. The column would be set to missing for zip codes that do not have as many neighbors.
Basically, I want to do this (Finding all neighbors for all polygons in Spatialite) in qgis. I guess I'm asking whether the command in the link would generate what I want described above, and if it does how I can run it. I have PostGIS installed at this point, but I do not know how I can load the vector on it using QGIS and PSQL...
Basically, I am very unfamiliar with QGIS, except being able to load a vector layer using .shp file. I would like to know how to get to the part where I can use the command like
SELECT p1.ROWID, p1.ZCTA5CE10, p2.ZCTA5CE10
FROM "US_zcta5_2010" p1, "US_zcta5_2010" p2
WHERE Touches (p1.Geometry, p2.Geometry)=1;