Open vpavic opened 2 years ago
Forgot to mention, I'm working around the issue by providing something like this as a replacement for org.geojson.FeatureCollection
:
@JsonIgnoreProperties(ignoreUnknown = true)
record FeatureCollection(List<Feature> features) {
@JsonCreator
FeatureCollection(@JsonProperty("features") List<Feature> features) {
this.features = features;
}
}
Another, perhaps more elegant, workaround is to provide a mix-in that ignores Crs
altogether:
@JsonIgnoreType
class IgnoreTypeMixin {
}
JsonMapper jsonMapper = JsonMapper.builder()
.addMixIn(Crs.class, IgnoreTypeMixin.class)
.build();
At present,
type
property ofcrs
is mapped toorg.geojson.jackson.CrsType
enum. This makes it challenging to parse GeoJSON containingcrs.type
value outside of those outlined by the spec (and present in the enum).One such example is government WFS service that provides cadastral data here in Croatia. The
crs
property of GeoJSON returned by this service contains the following:Attempting to parse such GeoJSON using something like:
Fails with
InvalidFormatException
:Additionally, GeoJSON spec linked in introduction is obsoleted by RFC 7946 which actually removes
crs
from the spec. See Appendix B of the RFC:All of this IMO supports the case for a more lenient parsing of
crs
ingeojson-jackson
.