Hello,
Op 17-12-18 om 18:18 schreef Imre Samu:
> >Most of this data can be inferred, but is not available as `addr:*`
> tags; when things like `addr:city` are, empty on nodes, they can be
> inferred from administrative boundaries, instead. ....
> >Has someone done this with imposm already? If so, is there a standard
> or common set-up to get such data into postgresql/postgis?
>
> imho: in this case:
> - You can import the admin polygons ( with imposm3) - and you can add
> the missing addr:city tags - with SQL postprocessing
> (
https://postgis.net/docs/ST_Contains.html ) it is faster than
> calling external services.
>
This, together with the SQL-post-processing as proposed by Sven, seems
like a good strategy.
It has some downsides though: administrative boundaries don't include
street level address details, since they are not infered from
ST_Contains but instead by more complex logic such as interpolating
numbers and looking at the closest way-polygon. Nominatim or even
closed-source services like OpenCage do provide this data.
Using this strategy would work for providing "country", "city",
"province" and in some cases "postal code regions" though. Not a full
address, but a long way towards it.
It does imply that my import fills at least a table with administrative
boundaries, which is then used to update the POIs that lack addr: tags.
Something like the following seems a good strategy. I like it
especially, because it would keep everything contained in
imposm+postgres. No external dependencies to install, maintain and monitor!
I could trigger a SQL script that uses the data from an
osm_administrative table into the POI table. Duplicating and
denormalising, but ensuring that each POI has some basic addr data filled.
Alternative is to join an `administrative` table on ST_Contains() and
then fetch country, province/district, city, etc from the join and use
that. Normalising but making the queries rather complex.
Thanks for the thoughts! I'll report back after I've played around with
this and know how this works. Mostly about how far this brings me, and
if getting streets and housenumbers right is remotely possible this way.
Bèr