C# 클래스 SharpMap.Data.Providers.ShapeFile

Shapefile dataprovider

The ShapeFile provider is used for accessing ESRI ShapeFiles. The ShapeFile should at least contain the [filename].shp, [filename].idx, and if feature-data is to be used, also [filename].dbf file.

The first time the ShapeFile is accessed, SharpMap will automatically create a spatial index of the shp-file, and save it as [filename].shp.sidx. If you change or update the contents of the .shp file, delete the .sidx file to force SharpMap to rebuilt it. In web applications, the index will automatically be cached to memory for faster access, so to reload the index, you will need to restart the web application as well.

M and Z values in a shapefile is ignored by SharpMap.

상속: SharpMap.Data.Providers.IProvider, IDisposable
파일 보기 프로젝트 열기: jumpinjackie/fdotoolbox 1 사용 예제들

공개 메소드들

메소드 설명
Close ( ) : void

Closes the datasource

Dispose ( ) : void

Disposes the object

ExecuteIntersectionQuery ( SharpMap geom, FeatureDataSet ds ) : void

Returns the data associated with all the geometries that are intersected by 'geom'. Please note that the ShapeFile provider currently doesn't fully support geometryintersection and thus only BoundingBox/BoundingBox querying are performed. The results are NOT guaranteed to lie withing 'geom'.

ExecuteIntersectionQuery ( SharpMap bbox, SharpMap ds ) : void

Returns all objects whose boundingbox intersects bbox.

Please note that this method doesn't guarantee that the geometries returned actually intersect 'bbox', but only that their boundingbox intersects 'bbox'.

GetExtents ( ) : SharpMap.Geometries.BoundingBox

Returns the extents of the datasource

GetFeature ( uint RowID ) : SharpMap.Data.FeatureDataRow

Gets a datarow from the datasource at the specified index

GetFeature ( uint RowID, FeatureDataTable dt ) : SharpMap.Data.FeatureDataRow

Gets a datarow from the datasource at the specified index belonging to the specified datatable

GetFeatureCount ( ) : int

Returns the total number of features in the datasource (without any filter applied)

GetGeometriesInView ( SharpMap bbox ) : List

Returns geometries whose bounding box intersects 'bbox'

Please note that this method doesn't guarantee that the geometries returned actually intersect 'bbox', but only that their boundingbox intersects 'bbox'.

This method is much faster than the QueryFeatures method, because intersection tests are performed on objects simplifed by their boundingbox, and using the Spatial Index.

GetGeometryByID ( uint oid ) : SharpMap.Geometries.Geometry

Returns the geometry corresponding to the Object ID

GetObjectIDsInView ( SharpMap bbox ) : List

Returns geometry Object IDs whose bounding box intersects 'bbox'

GetXYTolerance ( ) : double?
Open ( ) : void

Opens the datasource

RebuildSpatialIndex ( ) : void

Forces a rebuild of the spatial index. If the instance of the ShapeFile provider uses a file-based index the file is rewritten to disk.

ShapeFile ( string filename ) : System

Initializes a ShapeFile DataProvider without a file-based spatial index.

ShapeFile ( string filename, bool fileBasedIndex ) : System

Initializes a ShapeFile DataProvider.

If FileBasedIndex is true, the spatial index will be read from a local copy. If it doesn't exist, it will be generated and saved to [filename] + '.sidx'.

Using a file-based index is especially recommended for ASP.NET applications which will speed up start-up time when the cache has been emptied.

비공개 메소드들

메소드 설명
CreateSpatialIndex ( string filename ) : Utilities.SpatialIndexing.QuadTree

Generates a spatial index for a specified shape file.

CreateSpatialIndexFromFile ( string filename ) : Utilities.SpatialIndexing.QuadTree

Loads a spatial index from a file. If it doesn't exist, one is created and saved

Dispose ( bool disposing ) : void
GetAllFeatureBoundingBoxes ( ) : List

Reads all boundingboxes of features in the shapefile. This is used for spatial indexing.

GetShapeIndex ( uint n ) : int

Gets the file position of the n'th shape

InitializeShape ( string filename, bool FileBasedIndex ) : void
LoadSpatialIndex ( ) : void
LoadSpatialIndex ( bool LoadFromFile ) : void
LoadSpatialIndex ( bool ForceRebuild, bool LoadFromFile ) : void
ParseHeader ( ) : void

Reads and parses the header of the .shx index file

ParseProjection ( ) : void

Reads and parses the projection if a projection file exists

ReadGeometry ( uint oid ) : SharpMap.Geometries.Geometry

Reads and parses the geometry with ID 'oid' from the ShapeFile

Filtering is not applied to this method

ReadIndex ( ) : int[]

Reads the record offsets from the .shx index file and returns the information in an array

SwapByteOrder ( int i ) : int

Swaps the byte order of an int32

메소드 상세

Close() 공개 메소드

Closes the datasource
public Close ( ) : void
리턴 void

Dispose() 공개 메소드

Disposes the object
public Dispose ( ) : void
리턴 void

ExecuteIntersectionQuery() 공개 메소드

Returns the data associated with all the geometries that are intersected by 'geom'. Please note that the ShapeFile provider currently doesn't fully support geometryintersection and thus only BoundingBox/BoundingBox querying are performed. The results are NOT guaranteed to lie withing 'geom'.
public ExecuteIntersectionQuery ( SharpMap geom, FeatureDataSet ds ) : void
geom SharpMap
ds FeatureDataSet FeatureDataSet to fill data into
리턴 void

ExecuteIntersectionQuery() 공개 메소드

Returns all objects whose boundingbox intersects bbox.

Please note that this method doesn't guarantee that the geometries returned actually intersect 'bbox', but only that their boundingbox intersects 'bbox'.

public ExecuteIntersectionQuery ( SharpMap bbox, SharpMap ds ) : void
bbox SharpMap
ds SharpMap
리턴 void

GetExtents() 공개 메소드

Returns the extents of the datasource
public GetExtents ( ) : SharpMap.Geometries.BoundingBox
리턴 SharpMap.Geometries.BoundingBox

GetFeature() 공개 메소드

Gets a datarow from the datasource at the specified index
public GetFeature ( uint RowID ) : SharpMap.Data.FeatureDataRow
RowID uint
리턴 SharpMap.Data.FeatureDataRow

GetFeature() 공개 메소드

Gets a datarow from the datasource at the specified index belonging to the specified datatable
public GetFeature ( uint RowID, FeatureDataTable dt ) : SharpMap.Data.FeatureDataRow
RowID uint
dt FeatureDataTable Datatable to feature should belong to.
리턴 SharpMap.Data.FeatureDataRow

GetFeatureCount() 공개 메소드

Returns the total number of features in the datasource (without any filter applied)
public GetFeatureCount ( ) : int
리턴 int

GetGeometriesInView() 공개 메소드

Returns geometries whose bounding box intersects 'bbox'

Please note that this method doesn't guarantee that the geometries returned actually intersect 'bbox', but only that their boundingbox intersects 'bbox'.

This method is much faster than the QueryFeatures method, because intersection tests are performed on objects simplifed by their boundingbox, and using the Spatial Index.

public GetGeometriesInView ( SharpMap bbox ) : List
bbox SharpMap
리턴 List

GetGeometryByID() 공개 메소드

Returns the geometry corresponding to the Object ID
public GetGeometryByID ( uint oid ) : SharpMap.Geometries.Geometry
oid uint Object ID
리턴 SharpMap.Geometries.Geometry

GetObjectIDsInView() 공개 메소드

Returns geometry Object IDs whose bounding box intersects 'bbox'
public GetObjectIDsInView ( SharpMap bbox ) : List
bbox SharpMap
리턴 List

GetXYTolerance() 공개 메소드

public GetXYTolerance ( ) : double?
리턴 double?

Open() 공개 메소드

Opens the datasource
public Open ( ) : void
리턴 void

RebuildSpatialIndex() 공개 메소드

Forces a rebuild of the spatial index. If the instance of the ShapeFile provider uses a file-based index the file is rewritten to disk.
public RebuildSpatialIndex ( ) : void
리턴 void

ShapeFile() 공개 메소드

Initializes a ShapeFile DataProvider without a file-based spatial index.
public ShapeFile ( string filename ) : System
filename string Path to shape file
리턴 System

ShapeFile() 공개 메소드

Initializes a ShapeFile DataProvider.

If FileBasedIndex is true, the spatial index will be read from a local copy. If it doesn't exist, it will be generated and saved to [filename] + '.sidx'.

Using a file-based index is especially recommended for ASP.NET applications which will speed up start-up time when the cache has been emptied.

public ShapeFile ( string filename, bool fileBasedIndex ) : System
filename string Path to shape file
fileBasedIndex bool Use file-based spatial index
리턴 System