예제 #1
0
        public static Dictionary <string, GeoJSONObject>?ToGeo(this ContentData data, IJsonSerializer jsonSerializer)
        {
            Dictionary <string, GeoJSONObject>?result = null;

            foreach (var(field, value) in data)
            {
                if (value != null)
                {
                    foreach (var(key, jsonValue) in value)
                    {
                        if (GeoJsonValue.TryParse(jsonValue, jsonSerializer, out var geoJson) == GeoJsonParseResult.Success)
                        {
                            result ??= new Dictionary <string, GeoJSONObject>();
                            result[$"{field}.{key}"] = geoJson;
                        }
                    }
                }
            }

            return(result);
        }
예제 #2
0
        public bool Visit(IField <GeolocationFieldProperties> field, Args args)
        {
            var result = GeoJsonValue.TryParse(args.Value, args.JsonSerializer, out _);

            return(result == GeoJsonParseResult.Success);
        }