Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="gisFile"></param>
        /// <param name="originalFilename">This is the original name of the file as it appeared on the users file system. It is provided just for error messaging purposes.</param>
        /// <param name="organization"></param>
        /// <returns></returns>
        public static List <OrganizationBoundaryStaging> CreateOrganizationBoundaryStagingStagingListFromGdb(FileInfo gisFile, string originalFilename, Organization organization)
        {
            var ogr2OgrCommandLineRunner = new Ogr2OgrCommandLineRunner(FirmaWebConfiguration.Ogr2OgrExecutable,
                                                                        LtInfoGeometryConfiguration.DefaultCoordinateSystemId,
                                                                        FirmaWebConfiguration.HttpRuntimeExecutionTimeout.TotalMilliseconds);

            var geoJsons =
                OgrInfoCommandLineRunner.GetFeatureClassNamesFromFileGdb(new FileInfo(FirmaWebConfiguration.OgrInfoExecutable), gisFile, originalFilename, Ogr2OgrCommandLineRunner.DefaultTimeOut)
                .ToDictionary(x => x, x => ogr2OgrCommandLineRunner.ImportFileGdbToGeoJson(gisFile, x, false))
                .Where(x => OrganizationBoundaryStaging.IsUsableFeatureCollectionGeoJson(JsonTools.DeserializeObject <FeatureCollection>(x.Value)))
                .ToDictionary(x => x.Key, x => new FeatureCollection(JsonTools.DeserializeObject <FeatureCollection>(x.Value).Features.Where(OrganizationBoundaryStaging.IsUsableFeatureGeoJson).ToList()).ToGeoJsonString());

            Check.Assert(geoJsons.Count != 0, "Number of usable Feature Classes in uploaded file must be greater than 0.");

            return(geoJsons.Select(x => new OrganizationBoundaryStaging(organization, x.Key, x.Value)).ToList());
        }
Ejemplo n.º 2
0
 public static void DeleteOrganizationBoundaryStaging(this IQueryable <OrganizationBoundaryStaging> organizationBoundaryStagings, OrganizationBoundaryStaging organizationBoundaryStagingToDelete)
 {
     DeleteOrganizationBoundaryStaging(organizationBoundaryStagings, new List <OrganizationBoundaryStaging> {
         organizationBoundaryStagingToDelete
     });
 }