I am building an application for a customer in which they will type the name of a place (i.e. the name column on planet_osm_polygon of a osm2pgsql imported database) and get a boundary. I was successful in setting up the system, and I've been able to optimize the planet_osm_polygon table for trigram searching (with pg_trgm). The system now works -- awesome! However, I'd like to "join" the tags column from the planet_osm_rels table by the osm_id provided in results from planet_osm_polygon. I understand that osm2pgsql does not provide any foreign key constraints. With that said, I'd like to know: If it possible for me to add this foreign key relationship myself? Any recommendations for re-approaching the problem are welcome. asked 03 Feb '18, 15:09 ethanhinson |
There is no reasonable way to add foreign keys to this schema. The way to accomplish this is to make sure you use the --hstore-all option. This will create a new column on the polygon table (planet_osm_polygon in my case) which contains all the tags associated with that particular polygon. answered 04 Feb '18, 17:40 ethanhinson |