Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Roundtrip Serializing/Deserializing a Feature fails #120

Closed
DustinReagan opened this issue Aug 25, 2016 · 8 comments
Closed

Roundtrip Serializing/Deserializing a Feature fails #120

DustinReagan opened this issue Aug 25, 2016 · 8 comments
Assignees
Labels

Comments

@DustinReagan
Copy link

See this StackOverflow link for details.

@DGuidi DGuidi self-assigned this Aug 26, 2016
@DGuidi DGuidi added the bug label Aug 26, 2016
@DGuidi
Copy link
Contributor

DGuidi commented Aug 26, 2016

the presence of \"properties\":null looks the cause of the bug.

@DGuidi
Copy link
Contributor

DGuidi commented Aug 26, 2016

fixed. can you check if this fix resolve your issues?
anyway, thanks for reporting this :)

@FObermaier
Copy link
Member

@DGuidi: The question is where does "properties":null come from in the first place? Was that created by the GeoJsonWriter and if so, does that conform to the json/geojson standard.

@DGuidi
Copy link
Contributor

DGuidi commented Aug 26, 2016

@FObermaier heres' my thoughts

  1. good question: issue doesn't provide initial feature object used in with GeoJSONWriter, but I can make some additional checks.
  2. GeoJSON specs explicitly allows null.

a feature object must have a member with the name "properties". The value of the properties member is an object (any JSON object or a JSON null value).

@DGuidi
Copy link
Contributor

DGuidi commented Aug 26, 2016

@DustinReagan can you provide a sample code that generates a GeoJSON with \"properties\":null?
I've made some checks and I'm unable to generate a similar json using GeoJSONWriter

@DustinReagan
Copy link
Author

@DustinReagan can you provide a sample code that generates a GeoJSON with "properties":null?
I've made some checks and I'm unable to generate a similar json using GeoJSONWriter

@DGuidi Sure:

Geometry geometry = SomeMethodThatCreatesAGeometry(); Feature feature = new Feature(geometry, null);

Thanks for looking into this bug. For now, I've just resolved my issue by doing:

Feature feature = new Feature(geometry, new AttributeTable());

@DGuidi
Copy link
Contributor

DGuidi commented Aug 26, 2016

Tried code like this but geojson writer doesn't produce a json string but throws exception, at least using latest master.
I give some other checks soon. Thanks again.

@FObermaier
Copy link
Member

With 243ede3 the following improvements have been made to the converter objects:

  • when serializing, they obey to JsonSerializer.NullValueHandling
  • when deserializing, they don't fail when encountering null tokens.

FObermaier added a commit that referenced this issue Sep 14, 2016
Fixing Category("GitHub") to Category("GitHub Issues")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants