CreateFromIFeature() public static method

Creates A GeoJSON feature from an IFeature
public static CreateFromIFeature ( IFeature feat ) : GeoJSONFeature
feat IFeature The feature.
return GeoJSONFeature
Example #1
0
        /// <summary>
        /// Creates the GeoJSON feature collection from list of <see cref="ArcDeveloper.REST.Core.Interfaces.IFeature"/>.
        /// </summary>
        /// <param name="features">The features.</param>
        /// <returns>A GeoJSON feature collection</returns>
        public static GeoJSONFeatureCollection CreateFeatureCollectionFromList(List <IFeature> features)
        {
            GeoJSONFeatureCollection featCollection = new GeoJSONFeatureCollection();

            foreach (IFeature feat in features)
            {
                featCollection.Features.Add(GeoJSONFeature.CreateFromIFeature(feat));
            }
            return(featCollection);
        }
Example #2
0
        public string GetAsGeoJSON(IRecordSet recordset)
        {
            GeoJSONFeatureCollection jsonFeatures = new GeoJSONFeatureCollection();
            ICursor cur = recordset.get_Cursor(false);

            IFeature f = (IFeature)cur.NextRow();

            if (f != null)
            {
                while (f != null)
                {
                    jsonFeatures.Features.Add(GeoJSONFeature.CreateFromIFeature(f));
                    f = (IFeature)cur.NextRow();
                }
            }

            return("{}");
        }