Skip to content

Support specifying precision for geo.io write functions #73

Description

@kirahowe

Hi there, thanks for this cool and useful library. I was just wondering what you all think of the idea of being able to specify a number of decimal places for coordinates for the various to-<format> functions. I find using this library so much nicer than working e.g. geotools or other java libraries in my clojure projects, but one thing I miss is being able to sneak in rounding coordinates whilst converting between formats, e.g. using geotools libs I used to do:

(->> wkt-literal
     (.read (WKTReader2.))
     (.toString (GeometryJSON. 6)))

(where that 6 is the number of decimals to use when encoding the numbers)

I find this much nicer with this library (e.g. (-> wkt-literal geoio/read-wkt geoio/to-geojson)), but to get identical results I need to add an extra transformation step to round all the coordinates. This isn't really a big deal, but I wanted too see what you think of adding a second arity to the to-<format> functions in this library to support this. I could possibly help out with a PR for that if it's something you think is reasonable. I also totally understand if there are reasons why this is a bad idea and you don't want it in.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions