opendatalab-de / geojson-jackson

GeoJson POJOs for Jackson - serialize and deserialize objects with ease
http://blog.opendatalab.de
Apache License 2.0
263 stars 94 forks source link

Add support for a foreign Member #34

Closed bryn2008 closed 7 years ago

bryn2008 commented 7 years ago

When trying to add Parameters to hold some metadata on the geojson, I was unable to find a method for adding a foreign member.

Is this something that can be added?

grundid commented 7 years ago

Thanks for bringing this up. If I understand this correctly, foreign members are a new feature of the RFC 7946 spec. https://tools.ietf.org/html/rfc7946#section-6.1

This library implements the 2008 GeoJSON specification. To support this feature the base class would have to extend the HashMap class. Or do you see a different solution?

bryn2008 commented 7 years ago

Hi grundid, thank you for getting back to me. I'm assuming the base class is GeoJsonObject and so extending would look like this:

public abstract class GeoJsonObject extends extends HashMap<String, Object> implements Serializable {

It might cause a problem if an objects key in the HashMap was to be called the same as something that is already in the GeoJson.

It would be good to see a method that adds the foreign member to a feature, like so:

feature.setForeignMembers(Map<String, Object> foreignMembers);