-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Polymorphism? #17
Comments
Can you give me an example of what can't be done without this converter so I can understand the issue a little better? |
Lets say, I have the following request definition:
So the user can either give in a point or circle or polygon or whatever. I don't see how this is possible at the moment and I also tested it and got an error. |
What you want works by using the geometry interface. IGeometryObject |
Oh, sorry ... have not seen that. Why is there both a interface and a abstract class? |
I sadly do not know, since i have not been a part of the initial implementation of the library, i just converted it to system.text.json, but i guess the abstract class exists to share common properties to all of the geometry object types. |
Is there a way to get this to work with any GeoJson object, not only geometry types (i.e. also Feature and Feature Collection). Using IGeoJsonObject does not seem to work? I would like to serialize any type of geoJson object, but this does not work:
I can properly serialize it as a feature collection, but this is not polymorphic:
Using IGeometryObject is not an option, because not all GeoJson objects are geometry objects:
|
ditto. need to parse GeoJson data without knowing beforehand whether it is a geometry or feature or feature collection etc. how ? |
It looks like this is within reach, it just requires another converter for the top level GeoJSON.Text/src/GeoJSON.Text/Converters/GeometryConverter.cs Lines 86 to 107 in 31ec322
|
Have you not handled polymorphism? I do not see converters for GeoJSONObject ot the interfaces.
The text was updated successfully, but these errors were encountered: