Closed rrrnld closed 6 years ago
@heyarne thanks for reporting this. Unfortunately the geojson reader we are using at the moment (which is just the built-in JTS GeoJSONReader) does not handle Features or FeatureCollections -- only basic geometries.
It looks like some libraries (e.g. https://github.com/bjornharrtell/jts2geojson) do handle these by doing some extra processing before converting them to geometries. I'll have to do a bit of research to see if this is something we can incorporate cleanly.
jts2geojson has now been updated to JTS 1.15 and a release was cut two days ago, so it doesn't conflict anymore.
Does it make sense that we re-add jts2geojson so that we can read and write these collections, but also keep the JTS io library so that we can do things like the EWKB (being discussed now in #10)?
@heyarne @worace
I think the actual error reported might not be about the Feature/FeatureCollection issue (which throws an UnsupportedOperationException for me when using geo 1.2.0), and as discussed above, changes are indeed needed to successfully parse the geojson listed in the example.
gorilla-repl 0.4.0 uses cheshire 5.3.1 which uses jackson 2.3.1, which would lead to the MethodError reported (see #13). Solving this may require either excluding gorilla-repl or getting it to use a newer version of cheshire.
Is this issue resolved?
(-> (slurp "https://gist.githubusercontent.com/heyarne/09812024067c4db239df2181c347f743/raw/a9a372710097e4d2c3df699e3b84cdfd1526eb7e/isochrones-galton-lat:52.5219184-lng:13.4132147.geojson")
(read-geojson)
(nth 2))
=>
{:properties {:time 30},
:geometry #object[org.locationtech.jts.geom.MultiPolygon
0x5caf2c13
"MULTIPOLYGON (((13.323281 52.544492, 13.324786 52.541774, 13.325686 52.543418, 13.324889 52.54385, 13.323324 52.550874, 13.323415 52.550102, 13.323281 52.544492)), ((13.407952 52.465478, 13.398501 52.466007, 13.402426 52.465567, 13.402496 52.465578, 13.404727 52.465363, 13.407952 52.465478)))"]}
Just tried it via clj -Sdeps '{:deps {factual/geo {:mvn/version "2.0.0-rc-3"}}}
, works like a charm! Thanks a lot!
throws the following exception:
My
project.clj
:Environment info: