omniscale / imposm3

Imposm imports OpenStreetMap data into PostGIS
http://imposm.org/docs/imposm3/latest/
Apache License 2.0
719 stars 158 forks source link

Proposal for: imposm3 "Custom field/filter functions" #77

Closed ImreSamu closed 7 years ago

ImreSamu commented 8 years ago

Hello,

Sometimes I only need unique "custom field" and I want just drop the hand made source code. but maybe others can reuse some code.

So my vision:

The suggested procedure for install will be similar:

git clone https://github.com/omniscale/imposm3  ...
// fieldtype_install command: only download the Golang code and copy to the mapping directory
fieldtype_install "current_dateutc"
fieldtype_install "coalesce"
fieldtype_install "hstore_tags_keep"
fieldtype_install "hstore_tags_drop"
fieldtype_install "jsonb_example"
fieldtype_install "sleep"
godep go install ... 

I have created some draft proof of concept code:

Patch for the current system: https://github.com/ImreSamu/imposm3/tree/fieldtypes_addon

Example function ( very draft ) https://github.com/ImreSamu/imposm3_fieldtypes/blob/master/mapping/fieldtype_current_dateutc.go

Example repository : https://github.com/ImreSamu/imposm3_fieldtypes draft examples ( later I will create a better documentation )

I like the idea of 1 Golang file = 1 FieldType Definition

My question:

olt commented 8 years ago

Having custom field types (similar to Imposm 2) is something I'd really like to see in Impsom 3. Embedding Lua might be the best way to allow a user to define custom field types. But this will require a lot more work than manually adding a few missing types to the Imposm Go code.

Adding more types (timestamp etc.) and having some utility functions to make this more easy would be ok for me, but I don't like to introduce an external repository infrastructure with FieldTypeDoc, fieldtype_install, etc.

ImreSamu commented 8 years ago

Thank you for your answer.

I have created a first proposal : https://github.com/omniscale/imposm3/pull/86

Later, I would like to discuss & add some new types :

and more later, I would like to testing some "geos-mapping" types like:

Thank you in advance!