whosonfirst / go-whosonfirst-pgis

This is not ready to use. It is still being tested. It will probably be renamed.
BSD 3-Clause "New" or "Revised" License
3 stars 2 forks source link

[WIP] Add `wd_id` + `properties` column #10

Closed ImreSamu closed 3 years ago

ImreSamu commented 6 years ago

Work in progess

Extending PG data with 2 new columns

becasuse my use case is very special, probably we need to add this columns via special optional command line parameters like:

thisisaaronland commented 6 years ago

A few comments:

ImreSamu commented 6 years ago

c.sh and t.sh scripts just helper tools

yes, ( and sorry for the noise ) I will remove this (helper) files

It's probably worth add a generic -add COLUMN#COLUMN_DEFINITION

good idea,

my use case is not typical

my long time vision:

it would be optimal for me if I can configure via yml file ( like in imposm3 / osm2pgsql tools )

with a carefully planned framework, i can implement, register and use any mapping functions I can dream of:

example - for the current columns

sql variable mapping func array of mapping parameters
id gjson.bigint.primarykey ["id"]
parent_id gjson.bigint ["properties.wof:parent_id"]
placetype_id placetype_id
wd_id gjson.text ["properties.wof:concordances.wd:id"]
is_superseded is_superseded
is_deprecated is_deprecated
meta meta
properties gjson.rawjson ["properties"]
geom_hash geom_hash.text
lastmod gjson.text ["properties.wof:lastmodified"]
geom geography.multipolygon
centroid geography.centroid

-add COLUMN#COLUMN_DEFINITION

The # char as a separator not ideal, it can be used as a gjson parameter

Rather than any ad hoc columns we can specify a fixed list of known/possible columns in a flags/column.go package.

I have collected some functions, as I see we need

see: https://gist.github.com/ImreSamu/143f01201a66085d869662ea61ca83ad

my favorite example:

mapping function id: gjson.sprintf

params:

example parameters:

example output - perfect Postgis Point for bulk loading:

Summary

ImreSamu commented 3 years ago

closing .. reason: I have started using a simple bash + postgres scripts for importing the geojson files ..