Closed ImreSamu closed 3 years ago
A few comments:
It's probably worth add a generic -add COLUMN#COLUMN_DEFINITION
flag that can be used beyond -add_wd_id
and --add_properties
. I agree that those shouldn't be part of core but I can imagine that there be other similar use cases in time. Rather than any ad hoc columns we can specify a fixed list of known/possible columns in a flags/column.go
package.
It seems like client.go
needs to be updated to account for additional properties (see above) which might be a little fiddly since Go is fiddly that way...
I'm not sure I understand what the dwindex
target is doing; either all the dependencies should be grouped under the deps
target.
Are the c.sh
and t.sh
scripts just helper tools or are they meant to be general usage applications? If the latter we should find some more descriptive names for them :-)
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
meta
columns ( so it would better if I can drop )coalesce(geom, centroid)
it would be optimal for me if I can configure via yml file ( like in imposm3 / osm2pgsql tools )
wof:country="hu"
)with a carefully planned framework, i can implement, register and use any mapping functions I can dream of:
gjson
pathslua
functions to transform valuesgit
information, historyjson
keysexample - 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
"properties.wof:belongsto.#"
-> number of wof:belongsto
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:
1.
: sprintf template2..n
: sprintf values ( gjson syntax )example parameters:
["SRID=4326;POINT(%v %v)", "properties.mps:longitude" , "properties.mps:longitude" ]
example output - perfect Postgis Point for bulk loading:
"SRID=4326;POINT(19.092281 47.516581)"
closing .. reason: I have started using a simple bash + postgres scripts for importing the geojson files ..
Work in progess
Extending PG data with 2 new columns
wd_id
::text : jsonpath:properties.wof:concordances.wd:id
properties
::json/jsonb : jsonpath:properties
becasuse my use case is very special, probably we need to add this columns via special optional command line parameters like:
go-whosonfirst-pgis --add_wd_id ...
( addwd_id
::text columns : default NOT add )go-whosonfirst-pgis --add_properties ...
( addproperties
JSON/JSONB columns : default NOT add )--add_wd_id --add_properties