Skip to content

Use mapstructure to decode geometry #188

Description

@bastienbc

Hi,

I'm using your library to convert some mongodb documents into postgis rows.
The way I do it is simple, with mongodb I decode the bson into a struct with map[string]interface{},
Then I use your library to convert the geojson part into ewkb.

But to do so I have to first use json.Marshal, because the Unmarshal method from geojson needs a json (in bytes) to Unmarshal it.
So it's Bson -> map[string]interface{} -> json -> Geometry

Would it be possible to use mapstructure to encode/decode (using maybe separate functions to not break the API), to prevent this kind of pattern?
It should be pretty simple from my very short experience with mapstructure in the past.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions