karimbahgat / PyCRS

Projection creation, and conversion to misc formats
MIT License
98 stars 20 forks source link

Accept proj4 as dict? #23

Closed karimbahgat closed 6 years ago

karimbahgat commented 6 years ago

Some libraries create proj4 representations as dicts instead of as a string. Probably useful to accept such a proj4 dict. This would be easy since internally we transform the string to dict anyway.

Should this be in a separate method loader.from_proj4_dict, or just allow loader.from_proj4() to accept either string or dict? @djhoese?

djhoese commented 6 years ago

I don't have strong feelings either way, but my preference is for from_proj4 to accept both. Also good to note that the dictionary keys should not include the + characters, at least that's the way I always use/create them.

micahcochran commented 6 years ago

just allow loader.from_proj4() to accept either string or dict?

I'd prefer to just allow from_proj4() to accept either. Within that function it is already converting the proj4 string into a dictionary. One function that accepts either seem more pythonic to me. My 2 cents.

karimbahgat commented 6 years ago

Sounds good, that would be my preference too, simpler API and more flexible input. And agree about + key signs.

karimbahgat commented 6 years ago

Added in 8f8857c302aa52cb0969976e61f73f1b0e588634.