⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 drv_shapefile.html

📁 gdal库的学习文档
💻 HTML
字号:
<html><head><title>ESRI Shapefile</title></head><body bgcolor="#ffffff"><h1>ESRI Shapefile</h1>All varieties of ESRI Shapefiles should be available for reading, andsimple 3D files can be created.<p>Normally the OGR Shapefile driver treats a whole directory of shapefilesas a dataset, and a single shapefile within that directory as a layer.  Inthis case the directory name should be used as the dataset name.  However,it is also possible to use one of the files (.shp, .shx or .dbf) in ashapefile set as the dataset name, and then it will be treated as a datasetwith one layer.<p>Currently the shapefile driver always returns polygons, rather thanmultipolygons, even for polygons with multiple outer rings.  This is aviolation of the OGR (and Simple Features) data model, and will be correctedat some point in the future.  The new ESRI measure values are discardedif encountered. <p>If a .prj files in old Arc/Info style or new ESRI OGC WKT style is present,it will be read and used to associate a projection with features.<p><h2>Spatial and Attribute Indexing</h2>The OGR Shapefile driver supports spatial indexing and a limited form ofattribute indexing.<p>The spatial indexing uses the same .qix quadtree spatial index files thatare used by UMN MapServer.  It does not support the ESRI spatial indexfiles (.sbn / .sbx).  Spatial indexing can accelerate spatially filteredpasses through large datasets to pick out a small area quite dramatically.<p>To create a spatial index, issue a SQL command of the form "CREATE SPATIAL INDEX ON tablename".  To delete a spatial index issue a command of theform "DROP SPATIAL INDEX ON tablename".<p>Currently the OGR Shapefile driver only supports attribute indexes for looking up specific values in a unique key column.  To create a spatialindex for a column issue an SQL command of the form "CREATE INDEX ON tablenameUSING fieldname".  To drop the attribute indexes issue a command of theform "DROP INDEX ON tablename".  The attribute index will accelerateWHERE clause searches of the form "fieldname = value".  The attributeindex is actually stored as a mapinfo format index and is not compatiblewith any other shapefile applications.<p><h2>Creation Issues</h2>The Shapefile driver treats a directory as a dataset, and each Shapefileset (.shp, .shx, and .dbf) as a layer.  The dataset name will be treatedas a directory name.  If the directory already exists it is used and existing files in the directory are ignored.  If the directory does notexist it will be created.<p>As a special case attempts to create a new dataset with the extension .shpwill result in a single file set being created instead of a directory.<p>ESRI shapefiles can only store one kind of geometry per layer (shapefile). On creation this is may be set based on the source file (if a uniform geometrytype is known from the source driver), or it may be set directly by theuser with the layer creation option SHPT (shown below).  If not set thelayer creation will fail.  If geometries of incompatible types are writtento the layer, the output will be terminated with an error.<p>Note that this can make it very difficult to translate a mixed geometry layerfrom another format into Shapefile format using ogr2ogr, since ogr2ogr hasno support for separating out geometries from a source layer.<p>Shapefile feature attributes are stored in an associated .dbf file, and soattributes suffer a number of limitations:<P><ul><li> Attribute names can only be up to 12 characters long.  Longer names willbe silently truncated.  This may result in non-unique column names, which will definately cause problems later. <p><li> Only Integer, Real and String field types are supported.  The variouslist, and binary field types cannot be created.<p><li> The field width and precision are directly used to establish storage size in the .dbf file.  This means that strings longer than the fieldwidth, or numbers that don't fit into the indicated field format will suffertruncation.<p><li> Integer fields without an explicit width are treated as width 11.<p><li> Real (floating point) fields without an explicit width are treated aswidth 24 with 15 decimal places of precision.<p><li> String fields without an assigned width are treated as 80 characters.<p></ul>Also, .dbf files are required to have at least one field.  If none are createdby the application an "FID" field will be automatically created and populatedwith the record number.<p>The OGR shapefile driver supports rewriting existing shapes in a shapefileas well as deleting shapes.  Deleted shapes are marked for deletion in the .dbf file, and then ignored by OGR.  To actually remove them permanently(resulting in renumbering of FIDs) invoke the SQL 'REPACK <tablename>' viathe datasource ExecuteSQL() method.<p><h3>Dataset Creation Options</h3>None<p><h3>Layer Creation Options</h3><b>SHPT=type</b>: Override the type of shapefile created.  Can be one ofNULL for a simple .dbf file with no .shp file,  POINT, ARC, POLYGON or MULTIPOINT for 2D, or POINTZ, ARCZ, POLYGONZ or MULTIPOINTZ for 3D.  Shapefiles with <i>measure</i>values are not supported, nor are MULTIPATCH files.<p><h3>Examples</h3>A merge of two shapefiles 'file1.shp' and 'file2.shp' into a new file'file_merged.shp' is performed like this:<pre>% ogr2ogr file_merged.shp file1.shp% ogr2ogr -update -append file_merged.shp file2.shp -nln file_merged</pre>The second command is opening file_merged.shp in update mode, and trying tofind existing layers and append the features being copied.<br>The -nln option sets the name of the layer to be copied to.<h3>See Also</h3><ul><li> <a href="http://shapelib.maptools.org/">Shapelib Page</a><p></ul></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -