Geo.JSON
Converts to and from GeoJSON
json = "{ \"type\": \"Point\", \"coordinates\": [100.0, 0.0] }"
geom = Geo.JSON.decode(json)
Geo.Point[coordinates: {100.0, 0.0}, srid: nil]
Geo.JSON.encode(geom)
"{ \"type\": \"Point\", \"coordinates\": [100.0, 0.0] }"
Geo.JSON.encode(geom, [skip_json: true])
%{ type: "Point", coordinates: [100.0, 0.0] }
Summary↑
decode(geo_json) | Takes a GeoJSON string or map representing GeoJSON and returns a Geometry |
encode(geom, opts \\ []) | Takes a Geometry and returns a GeoJSON string or a map representing the GeoJSON
if |
Functions
Specs:
- decode(Map.t | String.t) :: Geo.geometry
Takes a GeoJSON string or map representing GeoJSON and returns a Geometry
Specs:
- encode(Geo.geometry, Dict.t) :: binary | Map.t
Takes a Geometry and returns a GeoJSON string or a map representing the GeoJSON
if :skip_json
is giving in the opts.