C# Class Azavea.NijPredictivePolicing.ACSAlchemistLibrary.Transfer.AcsDataManager

This class does most of the heavy lifting of the ACS Alchemist
Inheritance: IDisposable
Datei anzeigen Open project: azavea/acs-alchemist Class Usage Examples

Public Properties

Property Type Description
AddGeometryAttributesToOutput bool
AddStrippedGEOIDcolumn bool
CurrentDataPath string
DBFilename string
DbClient IDataClient
DesiredVariablesFilename string
ExportFilterFilename string
GridCellHeight double
GridCellWidth double
GridEnvelopeFilename string
IncludeEmptyGridCells bool
OutputFolder string
OutputProjectionFilename string
PreserveJam bool
ReusePreviousJobTable bool
ShapePath string
State AcsState
WorkingPath string

Protected Properties

Property Type Description
_cancelled bool
_summaryLevel string

Public Methods

Method Description
AcsDataManager ( ) : System
AcsDataManager ( AcsState aState ) : System
AcsDataManager ( AcsState aState, string workingFolder, string year ) : System
Cancel ( ) : void
CheckAllGeometriesFile ( ) : bool

Downloads the census DATA for the given state

CheckBlockGroupFile ( ) : bool

Downloads the census DATA for the given state

CheckBuildVariableTable ( string tableName ) : bool

Gets the filtered LogicalRecordNumbers, and the requested variables, and builds a table of their crossjoin

CheckCensusAggregatedDataFile ( ) : bool
CheckColumnMappingsFile ( ) : bool
CheckDatabase ( ) : bool

Checks to see if the database exists, and if not, initializes it with the provided inputs

CheckShapefiles ( ) : bool

Downloads the SHAPE FILEs, must be run before initializing the database! Since this will be imported into the database!

CreateColumnMappingsTable ( DbConnection conn ) : bool
CreateGeographiesTable ( DbConnection conn ) : bool
Dispose ( ) : void
DownloadAndImportShapefile ( string desiredUrl, string destFilepath, string niceName, string tablename ) : bool

Helper function for retrieving a given zip file from a URL, decompressing it, finding a shapefile in it, and importing that into the database

ExportGriddedShapefile ( string tableName ) : bool

Retrieves the contents of the specified table, and writes them to a shapefile

ExportShapefile ( string tableName ) : bool

Retrieves the contents of the specified table, and writes them to a shapefile

GetAggregateDataPath ( ) : string

Gets either the standard data path based on year, or appends an 'all' if we're not doing tracts or block-groups

GetAllSequenceVariables ( ) : DataTable

Returns all the variable names in the columnMappings table

GetFilteredLRUs ( DbConnection conn ) : HashSet
GetFilteringGeometries ( string filename, ICoordinateSystem outputCrs ) : List
GetGeographyTablename ( ) : string
GetGeometryRowKeyGenerator ( ) : GetGeometryRowKey
GetGridEnvelope ( ) : GisSharpBlog.NetTopologySuite.Geometries.Envelope
GetLocalAllGeometriesZipFileName ( ) : string
GetLocalBlockGroupZipFileName ( ) : string
GetLocalColumnMappingsDirectory ( ) : string
GetLocalGeographyFileName ( ) : string
GetRequestedVariables ( DbConnection conn ) : DataTable

Currently rebuilds the requested variables table every time

GetShapeFeaturesToExport ( string tableName, bool spatialFilter ) : List

Given a table, returns a list of features to export. Assumes table geometries are in WGS84

Init ( ) : void

Initialize our properties, and ensure our path structure is intact

IsCancelled ( ) : bool
IsIncluded ( IGeometry geom, List filteringGeoms ) : bool
SetGridParam ( string gridArgs ) : void

Protected Methods

Method Description
GetShapeRowsByLOGRECNO ( DbConnection conn ) : DataRow>.Dictionary
InitDatabase ( ) : bool

Call this anyway, should only execute code inside safe blocks

Method Details

AcsDataManager() public method

public AcsDataManager ( ) : System
return System

AcsDataManager() public method

public AcsDataManager ( AcsState aState ) : System
aState AcsState
return System

AcsDataManager() public method

public AcsDataManager ( AcsState aState, string workingFolder, string year ) : System
aState AcsState
workingFolder string
year string
return System

Cancel() public method

public Cancel ( ) : void
return void

CheckAllGeometriesFile() public method

Downloads the census DATA for the given state
public CheckAllGeometriesFile ( ) : bool
return bool

CheckBlockGroupFile() public method

Downloads the census DATA for the given state
public CheckBlockGroupFile ( ) : bool
return bool

CheckBuildVariableTable() public method

Gets the filtered LogicalRecordNumbers, and the requested variables, and builds a table of their crossjoin
public CheckBuildVariableTable ( string tableName ) : bool
tableName string
return bool

CheckCensusAggregatedDataFile() public method

public CheckCensusAggregatedDataFile ( ) : bool
return bool

CheckColumnMappingsFile() public method

public CheckColumnMappingsFile ( ) : bool
return bool

CheckDatabase() public method

Checks to see if the database exists, and if not, initializes it with the provided inputs
public CheckDatabase ( ) : bool
return bool

CheckShapefiles() public method

Downloads the SHAPE FILEs, must be run before initializing the database! Since this will be imported into the database!
public CheckShapefiles ( ) : bool
return bool

CreateColumnMappingsTable() public method

public CreateColumnMappingsTable ( DbConnection conn ) : bool
conn System.Data.Common.DbConnection
return bool

CreateGeographiesTable() public method

public CreateGeographiesTable ( DbConnection conn ) : bool
conn System.Data.Common.DbConnection
return bool

Dispose() public method

public Dispose ( ) : void
return void

DownloadAndImportShapefile() public method

Helper function for retrieving a given zip file from a URL, decompressing it, finding a shapefile in it, and importing that into the database
public DownloadAndImportShapefile ( string desiredUrl, string destFilepath, string niceName, string tablename ) : bool
desiredUrl string
destFilepath string
niceName string
tablename string
return bool

ExportGriddedShapefile() public method

Retrieves the contents of the specified table, and writes them to a shapefile
public ExportGriddedShapefile ( string tableName ) : bool
tableName string
return bool

ExportShapefile() public method

Retrieves the contents of the specified table, and writes them to a shapefile
public ExportShapefile ( string tableName ) : bool
tableName string
return bool

GetAggregateDataPath() public method

Gets either the standard data path based on year, or appends an 'all' if we're not doing tracts or block-groups
public GetAggregateDataPath ( ) : string
return string

GetAllSequenceVariables() public method

Returns all the variable names in the columnMappings table
public GetAllSequenceVariables ( ) : DataTable
return System.Data.DataTable

GetFilteredLRUs() public method

public GetFilteredLRUs ( DbConnection conn ) : HashSet
conn System.Data.Common.DbConnection
return HashSet

GetFilteringGeometries() public method

public GetFilteringGeometries ( string filename, ICoordinateSystem outputCrs ) : List
filename string
outputCrs ICoordinateSystem
return List

GetGeographyTablename() public method

public GetGeographyTablename ( ) : string
return string

GetGeometryRowKeyGenerator() public method

public GetGeometryRowKeyGenerator ( ) : GetGeometryRowKey
return GetGeometryRowKey

GetGridEnvelope() public method

public GetGridEnvelope ( ) : GisSharpBlog.NetTopologySuite.Geometries.Envelope
return GisSharpBlog.NetTopologySuite.Geometries.Envelope

GetLocalAllGeometriesZipFileName() public method

public GetLocalAllGeometriesZipFileName ( ) : string
return string

GetLocalBlockGroupZipFileName() public method

public GetLocalBlockGroupZipFileName ( ) : string
return string

GetLocalColumnMappingsDirectory() public method

public GetLocalColumnMappingsDirectory ( ) : string
return string

GetLocalGeographyFileName() public method

public GetLocalGeographyFileName ( ) : string
return string

GetRequestedVariables() public method

Currently rebuilds the requested variables table every time
public GetRequestedVariables ( DbConnection conn ) : DataTable
conn System.Data.Common.DbConnection
return System.Data.DataTable

GetShapeFeaturesToExport() public method

Given a table, returns a list of features to export. Assumes table geometries are in WGS84
public GetShapeFeaturesToExport ( string tableName, bool spatialFilter ) : List
tableName string Name of the sqlite table
spatialFilter bool Should we load and use a spatial filter?
return List

GetShapeRowsByLOGRECNO() protected method

protected GetShapeRowsByLOGRECNO ( DbConnection conn ) : DataRow>.Dictionary
conn System.Data.Common.DbConnection
return DataRow>.Dictionary

Init() public method

Initialize our properties, and ensure our path structure is intact
public Init ( ) : void
return void

InitDatabase() protected method

Call this anyway, should only execute code inside safe blocks
protected InitDatabase ( ) : bool
return bool

IsCancelled() public method

public IsCancelled ( ) : bool
return bool

IsIncluded() public method

public IsIncluded ( IGeometry geom, List filteringGeoms ) : bool
geom IGeometry
filteringGeoms List
return bool

SetGridParam() public method

public SetGridParam ( string gridArgs ) : void
gridArgs string
return void

Property Details

AddGeometryAttributesToOutput public_oe property

If true, this feature will add a number of columns to the end of the export with calculated values about the projected geometries Area, Perimeter, and Centroid It should also truncate requested variables to make sure things fit, but should warn the user.
public bool AddGeometryAttributesToOutput
return bool

AddStrippedGEOIDcolumn public_oe property

If true, add column GEOID_STRP to the shapefile output with values the same as GEOID except without the "15000US" prefix
public bool AddStrippedGEOIDcolumn
return bool

CurrentDataPath public_oe property

public string CurrentDataPath
return string

DBFilename public_oe property

public string DBFilename
return string

DbClient public_oe property

public IDataClient DbClient
return IDataClient

DesiredVariablesFilename public_oe property

If set, the manager will read in as a CSV, and import the variable values into the provided job table
public string DesiredVariablesFilename
return string

ExportFilterFilename public_oe property

If set, the manager will look for a file of WKTs that it will use to ensure all exported geometries at least intersect
public string ExportFilterFilename
return string

GridCellHeight public_oe property

public double GridCellHeight
return double

GridCellWidth public_oe property

public double GridCellWidth
return double

GridEnvelopeFilename public_oe property

If set, the manager will use this envelope while calculating the export grid (minx, miny, maxx, maxy)
public string GridEnvelopeFilename
return string

IncludeEmptyGridCells public_oe property

public bool IncludeEmptyGridCells
return bool

OutputFolder public_oe property

public string OutputFolder
return string

OutputProjectionFilename public_oe property

public string OutputProjectionFilename
return string

PreserveJam public_oe property

public bool PreserveJam
return bool

ReusePreviousJobTable public_oe property

If set, the manager will re-use a previous job with the same name, instead of replacing it
public bool ReusePreviousJobTable
return bool

ShapePath public_oe property

public string ShapePath
return string

State public_oe property

Selected State
public AcsState State
return AcsState

WorkingPath public_oe property

public string WorkingPath
return string

_cancelled protected_oe property

protected bool _cancelled
return bool

_summaryLevel protected_oe property

protected string _summaryLevel
return string