You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Maybe it should be internal, since it makes no sense to use it externally.
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:
It looks like this is within reach, it just requires another converter for the top level IGeoJSONObject which can switch internally on GeoJSONObjectType, similar to how the polymorphic IGeometryObject converter works:
Activity
matt-lethargic commentedon Jul 24, 2022
Can you give me an example of what can't be done without this converter so I can understand the issue a little better?
SebastianStehle commentedon Jul 24, 2022
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.
MartinCarpentier commentedon Jul 30, 2022
What you want works by using the geometry interface.
IGeometryObject
SebastianStehle commentedon Jul 30, 2022
Oh, sorry ... have not seen that. Why is there both a interface and a abstract class?
MartinCarpentier commentedon Jul 30, 2022
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.
Maybe it should be internal, since it makes no sense to use it externally.
andreas-foreflight commentedon Sep 9, 2022
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:
hu-xd commentedon Jul 19, 2023
ditto. need to parse GeoJson data without knowing beforehand whether it is a geometry or feature or feature collection etc. how ?
crozone commentedon Oct 16, 2023
It looks like this is within reach, it just requires another converter for the top level
IGeoJSONObjectwhich can switch internally onGeoJSONObjectType, similar to how the polymorphicIGeometryObjectconverter works:GeoJSON.Text/src/GeoJSON.Text/Converters/GeometryConverter.cs
Lines 86 to 107 in 31ec322