C# Class Azavea.NijPredictivePolicing.ACSAlchemistLibrary.FileFormats.ShapefileHelper

This class contains a number of small utilities to simplify the use of shapefiles in the importer
Datei anzeigen Open project: azavea/acs-alchemist Class Usage Examples

Public Methods

Method Description
AddColumn ( GisSharpBlog.NetTopologySuite.IO.DbaseFileHeader header, string columnName, Type t ) : void

Helper function for SetupHeader, correctly maps C# data types to DbaseFileHeader types

GetGeomFactory ( ) : GisSharpBlog.NetTopologySuite.Geometries.GeometryFactory

Constructs the default GeometryFactory for 4269 (census projection)

GetRemoteShapefileURL ( BoundaryLevels level, string stateFips ) : string

Helper function for constructing the correct census URL for a particular Boundary Level / State

GetSchema ( SqliteDataClient client ) : DataTable

Helper function for checking structure of existing Db

ImportShapefile ( DbConnection conn, IDataClient client, string filename, string tableName, int srid ) : bool

Imports the provided shapefile into a sqlite database using the VirtualShape extension

IsForbiddenShapefileName ( string name ) : bool

Checks to make sure a given table name doesn't conflict with any of the census shapefiles

LoadShapefile ( string filename, string tableName, IDataClient DbClient, ICoordinateSystem &CRS ) : bool

Imports a shapefile into the database. Do not use this to load census shapefiles.

MakeCensusProjFile ( string filename ) : bool

Generates a proj file for a given shapefile if it's missing

MakeOutputProjFile ( string sourceProjectionFilename, string destShapefilename ) : bool

Copies an existing .prj file next to an existing shapefile (with correct destination name)

OpenShapefile ( string filename, string tableName ) : bool

Helper function for testing the shapefile importer

SetupHeader ( DataTable table ) : GisSharpBlog.NetTopologySuite.IO.DbaseFileHeader

Consumes an ADO.net datatable and correctly initializes a Shapefile header object

Method Details

AddColumn() public static method

Helper function for SetupHeader, correctly maps C# data types to DbaseFileHeader types
public static AddColumn ( GisSharpBlog.NetTopologySuite.IO.DbaseFileHeader header, string columnName, Type t ) : void
header GisSharpBlog.NetTopologySuite.IO.DbaseFileHeader
columnName string
t System.Type
return void

GetGeomFactory() public static method

Constructs the default GeometryFactory for 4269 (census projection)
public static GetGeomFactory ( ) : GisSharpBlog.NetTopologySuite.Geometries.GeometryFactory
return GisSharpBlog.NetTopologySuite.Geometries.GeometryFactory

GetRemoteShapefileURL() public static method

Helper function for constructing the correct census URL for a particular Boundary Level / State
public static GetRemoteShapefileURL ( BoundaryLevels level, string stateFips ) : string
level BoundaryLevels
stateFips string
return string

GetSchema() public static method

Helper function for checking structure of existing Db
public static GetSchema ( SqliteDataClient client ) : DataTable
client SqliteDataClient
return System.Data.DataTable

ImportShapefile() public static method

Imports the provided shapefile into a sqlite database using the VirtualShape extension
public static ImportShapefile ( DbConnection conn, IDataClient client, string filename, string tableName, int srid ) : bool
conn System.Data.Common.DbConnection
client IDataClient
filename string
tableName string
srid int
return bool

IsForbiddenShapefileName() public static method

Checks to make sure a given table name doesn't conflict with any of the census shapefiles
public static IsForbiddenShapefileName ( string name ) : bool
name string
return bool

LoadShapefile() public static method

Imports a shapefile into the database. Do not use this to load census shapefiles.
public static LoadShapefile ( string filename, string tableName, IDataClient DbClient, ICoordinateSystem &CRS ) : bool
filename string The path of the file to import
tableName string
DbClient IDataClient The database to load the file into
CRS ICoordinateSystem
return bool

MakeCensusProjFile() public static method

Generates a proj file for a given shapefile if it's missing
public static MakeCensusProjFile ( string filename ) : bool
filename string
return bool

MakeOutputProjFile() public static method

Copies an existing .prj file next to an existing shapefile (with correct destination name)
public static MakeOutputProjFile ( string sourceProjectionFilename, string destShapefilename ) : bool
sourceProjectionFilename string
destShapefilename string
return bool

OpenShapefile() public static method

Helper function for testing the shapefile importer
public static OpenShapefile ( string filename, string tableName ) : bool
filename string
tableName string
return bool

SetupHeader() public static method

Consumes an ADO.net datatable and correctly initializes a Shapefile header object
public static SetupHeader ( DataTable table ) : GisSharpBlog.NetTopologySuite.IO.DbaseFileHeader
table System.Data.DataTable
return GisSharpBlog.NetTopologySuite.IO.DbaseFileHeader