geo.io
Helper functions for converting JTS geometries to and from various
geospatial IO formats (geojson, wkt, wkb).
feature-list
(feature-list features)
GeoJSONFeatures
protocol
members
to-features
(to-features this)
GeoJSONGeometry
protocol
members
read-geometry
(read-geometry this)
parse-geojson
(parse-geojson geojson)
Parse a geojson using GeoJSONFactory's create
properties
(properties feature)
read-geojson
(read-geojson geojson)
(read-geojson geojson srid)
Parse a GeoJSON string into a sequence of maps representing GeoJSON "Features".
These will contain a :geometry key containing a JTS geometry and a :features key
containing a (possibly empty) map of features.
(read-geojson "{\"type\":\"Polygon\",\"coordinates\":[[[-70.0024,30.0019],[-70.0024,30.0016],[-70.0017,30.0016],[-70.0017,30.0019],[-70.0024,30.0019]]]}")
=> [{:properties {}, :geometry #object[org.locationtech.jts.geom.Polygon(...)]}]
(read-geojson "{\"type\":\"Feature\",\"geometry\":{\"type\":\"Point\",\"coordinates\":[0.0,0.0]},\"properties\":{\"name\":\"null island\"}}")
=> [{:properties {:name "null island"}
:geometry #object[org.locationtech.jts.geom.Point(...)]}]
(read-geojson "{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"geometry\":{\"type\":\"Point\",\"coordinates\":[0.0,0.0]},\"properties\":{\"name\":\"null island\"}}]}")
=> [{:properties {:name "null island"},
:geometry #object[org.locationtech.jts.geom.Point(...)]}]
read-geojson-geometry
(read-geojson-geometry geojson)
(read-geojson-geometry geojson srid)
Parse a GeoJSON string representing a single Geometry into a JTS Geometry.
read-wkb
(read-wkb bytes)
(read-wkb bytes srid)
Read a WKB byte array and convert to a Geometry.
Can optionally pass in SRID. Defaults to WGS84
read-wkb-hex
(read-wkb-hex s)
(read-wkb-hex s srid)
Read a WKB hex string and convert to a Geometry
read-wkt
(read-wkt wkt)
(read-wkt wkt srid)
Read a WKT string and convert to a Geometry.
Can optionally pass in SRID. Defaults to WGS84
to-ewkb
(to-ewkb shapelike)
to-ewkb-hex
(to-ewkb-hex shapelike)
Write an EWKB as a hex string, including any SRID
to-geojson
(to-geojson shapelike)
to-geojson-feature
(to-geojson-feature feature-map)
to-geojson-feature-collection
(to-geojson-feature-collection feature-maps)
to-wkb
(to-wkb shapelike)
Write a WKB, excluding any SRID
to-wkb-hex
(to-wkb-hex shapelike)
Write a WKB as a hex string, excluding any SRID