Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Geodatabase geo = Geodatabase.Open("");

            List <Table> tables = new List <Table>();

            List <string> featureClasses = geo.GetChildDatasets("\\", "Feature Class").ToList();

            foreach (string featureClassName in featureClasses)
            {
                tables.Add(geo.OpenTable(featureClassName));
            }

            string createTableSqlCommand = CreateTableColumns(tables[0].FieldInformation);

            FieldInfo fieldInfo = tables[0].FieldInformation;
            var       fields    = new List <string>();

            for (int i = 0; i < fieldInfo.Count; i++)
            {
                fields.Add(fieldInfo.GetFieldName(i));
            }

            var           countStatements = $"SELECT * FROM VAULTSCOT_AUTH_POINT_OCT18";
            RowCollection rows            = geo.ExecuteSQL(countStatements);
            WKBReader     reader          = new WKBReader();

            foreach (Row row in rows)
            {
                MultiPointShapeBuffer geometry = row.GetGeometry();
                var point = geometry.Points;
                //MULTIPOINT (295512,712727,0) throwing format exception - Resolved in upcoming commit.
                var geometryWKT = processMultiPointBuffer(geometry);
            }

            var           countEnumerator = rows.GetEnumerator();
            List <object> fieldValues     = new List <object>();

            if (rows != null)
            {
                countEnumerator.MoveNext();
                var shape = countEnumerator.Current["Shape"];

                for (int i = 0; i < fieldInfo.Count - 1; i++)
                {
                    var count = countEnumerator.Current[fields[i]];
                    fieldValues.Add(count);
                }
            }

            InsertTableValues(fieldValues, fieldInfo);
        }
Exemplo n.º 2
0
        public IDatasetRows ReadFeatureSet(string path)
        {
            if (!_openedGeoDb)
            {
                throw new InvalidOperationException("FileGeodatabase was not open");
            }

            var table = _geodatabase.OpenTable(path);

            _openedTables.Add(table);

            var datasetRows = new FgdbDatasetRows(table);

            return(datasetRows);
        }
Exemplo n.º 3
0
 public ActionResult States()
 {
     try
     {
         var           path        = Server.MapPath("/App_Data/mvc_samples.gdb");
         Geodatabase   gdb         = Geodatabase.Open(path);
         Table         statesTable = gdb.OpenTable("\\us_states");
         RowCollection rows        = statesTable.Search("*", "STATE_NAME LIKE 'M%'", RowInstance.Recycle);
         var           rval        = rows.ToGeoJson();
         gdb.Close();
         //gdb.Dispose();
         Response.ContentType = "application/json";
         object result = this.Content(rval);
         return(result as ActionResult);;
     }
     catch { return(null); }
 }