Knowledge (XXG)

Shapefile

Source 📝

29: 1286:
must be limited to interspersing null shapes with the single shape type declared in the file's header. A shapefile must not contain both polyline and polygon data, for example, the descriptions for a well (point), a river (polyline), and a lake (polygon) would be stored in three separate datasets.
1285:
Because the shape type precedes each geometry record, a shapefile is technically capable of storing a mixture of different shape types. However, the specification states, "All the non-Null shapes in a shapefile are required to be of the same shape type." Therefore, this ability to mix shape types
183:
The shapefile format stores the geometry as primitive geometric shapes like points, lines, and polygons. These shapes, together with data attributes that are linked to each shape, create the representation of the geographic data. The term "shapefile" is quite common, but the format consists of a
1116:
Using this index, it is possible to seek backwards in the shapefile by, first, seeking backwards in the shape index (which is possible because it uses fixed-length records), then reading the record offset, and using that offset to seek to the correct position in the
1173:
file, which is used only by Esri software. The format is not documented by Esri. However it has been reverse-engineered and documented by the open source community. The 100-byte header is similar to the one in
1257:
values, ESRI software represents these values as zeros — a very serious issue for analyzing quantitative data, as it may skew representation and statistics if null quantities are represented as zero
271: 1230:
component files cannot exceed 2 GB (or 2 bytes) — around 70 million point features at best. The maximum number of feature for other geometry types varies depending on the number of vertices used.
1273:
Supported field types are: floating point (13 character storage), integer (4 or 9 character storage), date (no time storage; 8 character storage), and text (maximum 254 character storage)
1316: 803:
The variable-length record contents depend on the shape type, which must be either the shape type given in the file header or Null. The following are the possible shape types:
172:
The shapefile format is a digital vector storage format for storing geographic location and associated attribute information. This format lacks the capacity to store
1311: 480:. Each of the variable-length records includes a record-header component and a record-contents component. A detailed description of the file format is given in the 534:
The main file header is fixed at 100 bytes in length and contains 17 fields; nine 4-byte (32-bit signed integer or int32) integer fields followed by eight 8-byte (
1458: 180:
version 2 in the early 1990s. It is now possible to read and write geographical datasets using the shapefile format with a wide variety of software.
247:— shape index format; a positional index of the feature geometry to allow seeking forwards and backwards quickly {content-type: x-gis/x-shapefile} 1506:
Libraries – Open Source (Apache License) Java libraries for reading/writing shapefiles and the associated dBase files (libraries are part of the
1475: 1305: 1528: 1404: 447:, so an implementer of the file formats must be very careful to respect the endianness of each field and treat it properly. 1295: 121: 84: 1157:
The names and values of attributes are not standardized, and will be different depending on the source of the shapefile.
696:
The file then contains any number of variable-length records. Each record is prefixed with a record header of 8 bytes:
500: 1128:
file. However, since a shapefile is supposed to always contain an index, doing so counts as repairing a corrupt file.
496: 1300: 654: 657:(MBR) of all shapes contained within the dataset; four doubles in the following order: min X, min Y, max X, max Y 477: 221:, legacy GIS software may expect that the filename prefix be limited to eight characters to conform to the DOS 1154:. The open-source shapefile C library, for example, calls its format "xBase" even though it's plain dBase IV. 512: 217:
file, but alone is incomplete for distribution as the other supporting files are required. In line with the
1503: 1499: 528: 91: 1523: 468:) contains the geometry data. Geometry of a given feature is stored as a set of vector coordinates. The 185: 153: 1065:
file, followed by any number of 8-byte fixed-length records which consist of the following two fields:
516: 423:
files, the shapes in each file correspond to each other in sequence (i.e., the first record in the
352: 173: 1253:(the main open source software library for reading and writing shapefile format datasets) support 1150:
IV format. The format is public knowledge, and has been implemented in many dBase clones known as
1121:
file. It is also possible to seek forwards an arbitrary number of records using the same method.
547: 520: 473: 378: 193: 39: 1061:
The index contains positional index of the feature geometry and the same 100-byte header as the
1347: 96: 535: 129: 109: 320:— a geocoding index for read-write datasets (ODB format) {content-type: x-gis/x-shapefile} 125: 503:, where the order is similarly (longitude latitude). Geometries may also support 3- or 4- 1186:
file contains all of the information necessary to successfully parse the spatial data.
519:. The user-defined M dimension can be used for one of many functions, such as storing 308:— an attribute index of the active fields in a table {content-type: x-gis/x-shapefile} 298:— a spatial index of the features that are read-only {content-type: x-gis/x-shapefile} 1517: 1207: 1170: 1039:: MBR, Number of parts, Number of points, Parts, Part types, Points, Z range, Z array 285: 117: 1411: 511:
and measure, respectively. A Z-dimension stores the elevation of each coordinate in
222: 1481: 499:, using the order (X Y) or (Easting Northing). This axis order is consistent for 1276:
Floating point numbers may contain rounding errors since they are stored as text
1211: 469: 225:
convention, though modern software applications accept files with longer names.
177: 28: 1254: 1077: 764: 708: 561: 444: 360: 238: 141: 59: 1459:"ArcGIS Desktop 9.3 Help – Geoprocessing considerations for shapefile output" 314:— a geocoding index for read-write datasets {content-type: x-gis/x-shapefile} 1492: 508: 504: 400: 370: 356: 515:, which can be used for analysis or for visualisation of geometries using 1495:– Open Source (MIT License) Python library for reading/writing shapefiles 1372: 1203: 923:: MBR, Number of parts, Number of points, Parts, Points, Z range, Z array 902:: MBR, Number of parts, Number of points, Parts, Points, Z range, Z array 396: 137: 133: 1507: 1261: 1241:
standard. This database format inherently has a number of limitations:
485: 184:
collection of files with a common filename prefix, stored in the same
1437: 1246: 1238: 1151: 1147: 254: 145: 1486: 1390: 1343: 1250: 1141: 1124:
It is possible to generate the complete index file given a lone
524: 404: 257:
IV format {content-type: application/octet-stream OR text/plain}
205: 149: 113: 74: 272:
well-known text representation of coordinate reference systems
685:
Range of M; two doubles in the following order: min M, max M
671:
Range of Z; two doubles in the following order: min Z, max Z
1146:
This file stores the attributes for each shape; it uses the
110:
data format for geographic information system (GIS) software
253:— attribute format; columnar attributes for each shape, in 1202:
The shapefile format does not have the ability to store
1178:. It is not currently implemented by other vendors. The 997:: MBR, Number of parts, Number of points, Parts, Points 976:: MBR, Number of parts, Number of points, Parts, Points 859:
MBR, Number of parts, Number of points, Parts, Points
848:
MBR, Number of parts, Number of points, Parts, Points
176:
information. The shapefile format was introduced with
1317:
Comparison of geographic information systems software
612:
File length (in 16-bit words, including the header)
1234: 1227: 1223: 1183: 1179: 1125: 1118: 1062: 489: 440: 436: 432: 428: 424: 420: 416: 412: 392: 386: 382: 374: 366: 348: 342: 327: 323: 317: 311: 305: 301: 295: 291: 281: 277: 267: 250: 244: 234: 214: 200: 196: 90: 80: 70: 58: 52: 48: 44: 38: 1194:The shapefile format has a number of limitations. 752:Following the record header is the actual record: 495:The 2D axis ordering of coordinate data assumes a 944:: MBR, Number of points, Points, Z range, Z array 288:of the features {content-type: x-gis/x-shapefile} 33:A vector map, with points, polylines and polygons 1489:– Free c library for reading/writing shapefiles 1312:List of geographic information systems software 1214:do have the ability to store feature topology. 1206:relationships between shapes. The ESRI ArcInfo 120:for data interoperability among Esri and other 1267:Maximum length of field names is 10 characters 484:. This format should not be confused with the 274:{content-type: text/plain OR application/text} 124:. The shapefile format can spatially describe 1453: 1451: 1377:Geographic Information Systems Stack Exchange 237:— shape format; the feature geometry itself { 8: 1482:Esri – Understanding Topology and Shapefiles 427:file corresponds to the first record in the 21: 488:shape font source format, which shares the 1478:– Esri Webhelp docs for ArcGIS 10.0 (2010) 1182:file is not strictly necessary, since the 407:software {content-type: x-gis/x-shapefile} 443:files have various fields with different 1338: 1336: 1334: 1332: 1067: 805: 754: 698: 545: 476:followed by one or more variable-length 1328: 1348:"ESRI Shapefile Technical Description" 1233:The attribute database format for the 20: 7: 1373:"qgis - Creating missing .shx file?" 1237:component file is based on an older 482:ESRI Shapefile Technical Description 363:{content-type: application/fgdc+xml} 341:(ArcGIS 8 and later) {content-type: 219:ESRI Shapefile Technical Description 112:. It is developed and regulated by 472:consists of a single fixed-length 270:— projection description, using a 14: 1306:Open Source Geospatial Foundation 1198:Topology and the shapefile format 783:Shape type (see reference below) 640:Shape type (see reference below) 1510:but could be used independently) 1410:. 4 October 2011. Archived from 1161:Shapefile spatial index format ( 1110:Record length (in 16-bit words) 1096:Record offset (in 16-bit words) 741:Record length (in 16-bit words) 538:) signed floating point fields: 27: 1270:Maximum number of fields is 255 1018:: MBR, Number of points, Points 97:Shapefile Technical Description 1053:Shapefile shape index format ( 870:MBR, Number of points, Points 108:format is a geospatial vector 1: 1296:Geographic information system 501:Geographic coordinate systems 326:— an attribute index for the 140:, representing, for example, 18:Geospatial vector data format 1264:field names or field storage 1132:Shapefile attribute format ( 580:File code (always hex value 213:relates specifically to the 497:Cartesian coordinate system 1545: 1391:"Shapefile C Library V1.2" 1301:Open Geospatial Consortium 1139: 655:Minimum bounding rectangle 381:to be used {content-type: 156:that describe it, such as 1476:Shapefile file extensions 507:Z and M coordinates, for 26: 1493:Python Shapefile Library 1436:Cepicky, Jachym (2017). 727:Record number (1-based) 692:Shapefile record headers 456:Shapefile shape format ( 152:. Each item usually has 60:Internet media type 1529:GIS vector file formats 1442:switchfromshapefile.org 1438:"Switch from Shapefile" 355:in XML format, such as 1461:. Esri. 24 April 2009. 550:of a .shp file format 399:spatial index used by 377:) for identifying the 369:— used to specify the 1487:shapelib.maptools.org 523:measures or relative 122:GIS software products 598:Unused; five uint32 517:3D computer graphics 330:file in the form of 241:: x-gis/x-shapefile} 1045:: M range, M array 1024:: M range, M array 1003:: M range, M array 982:: M range, M array 950:: M range, M array 929:: M range, M array 908:: M range, M array 551: 353:geospatial metadata 194:filename extensions 23: 1281:Mixing shape types 1245:While the current 546: 521:linear referencing 435:files, etc.). The 379:character encoding 118:open specification 40:Filename extension 1417:on 13 August 2016 1260:Poor support for 1222:The size of both 1169:This is a binary 1114: 1113: 1050: 1049: 801: 800: 748:Shapefile records 745: 744: 689: 688: 542:Shapefile headers 395:— an alternative 387:x-gis/x-shapefile 343:x-gis/x-shapefile 102: 101: 71:Developed by 65:x-gis/x-shapefile 1536: 1463: 1462: 1455: 1446: 1445: 1433: 1427: 1426: 1424: 1422: 1416: 1409: 1401: 1395: 1394: 1387: 1381: 1380: 1368: 1362: 1361: 1359: 1357: 1352: 1340: 1236: 1229: 1225: 1185: 1181: 1177: 1164: 1135: 1127: 1120: 1068: 1064: 1056: 806: 755: 699: 583: 552: 527:of a feature in 491: 467: 459: 442: 438: 434: 430: 426: 422: 418: 414: 394: 388: 384: 376: 368: 350: 344: 340: 329: 325: 319: 313: 307: 303: 297: 293: 283: 279: 269: 252: 246: 236: 216: 208: 202: 198: 54: 50: 46: 31: 24: 1544: 1543: 1539: 1538: 1537: 1535: 1534: 1533: 1514: 1513: 1472: 1467: 1466: 1457: 1456: 1449: 1435: 1434: 1430: 1420: 1418: 1414: 1407: 1403: 1402: 1398: 1389: 1388: 1384: 1370: 1369: 1365: 1355: 1353: 1350: 1342: 1341: 1330: 1325: 1292: 1283: 1220: 1200: 1192: 1175: 1167: 1162: 1144: 1138: 1133: 1059: 1054: 1040: 1022:Optional Fields 1019: 998: 977: 945: 924: 903: 882: 750: 694: 581: 544: 465: 464:The main file ( 462: 457: 453: 411:In each of the 331: 264: 231: 229:Mandatory files 204: 170: 66: 34: 19: 12: 11: 5: 1542: 1540: 1532: 1531: 1526: 1516: 1515: 1512: 1511: 1496: 1490: 1484: 1479: 1471: 1470:External links 1468: 1465: 1464: 1447: 1428: 1396: 1382: 1371:Rollason, Ed. 1363: 1327: 1326: 1324: 1321: 1320: 1319: 1314: 1309: 1303: 1298: 1291: 1288: 1282: 1279: 1278: 1277: 1274: 1271: 1268: 1265: 1258: 1249:standard, and 1219: 1216: 1199: 1196: 1191: 1188: 1166: 1159: 1140:Main article: 1137: 1130: 1112: 1111: 1108: 1105: 1102: 1098: 1097: 1094: 1091: 1088: 1084: 1083: 1080: 1075: 1072: 1058: 1051: 1048: 1047: 1034: 1031: 1027: 1026: 1013: 1010: 1006: 1005: 992: 989: 985: 984: 971: 968: 964: 963: 960: 957: 953: 952: 939: 936: 932: 931: 918: 915: 911: 910: 897: 894: 890: 889: 879: 876: 872: 871: 868: 865: 861: 860: 857: 854: 850: 849: 846: 843: 839: 838: 835: 832: 828: 827: 824: 821: 817: 816: 813: 810: 799: 798: 797:Shape content 795: 792: 789: 785: 784: 781: 778: 775: 771: 770: 767: 762: 759: 749: 746: 743: 742: 739: 736: 733: 729: 728: 725: 722: 719: 715: 714: 711: 706: 703: 693: 690: 687: 686: 683: 680: 677: 673: 672: 669: 666: 663: 659: 658: 652: 649: 646: 642: 641: 638: 635: 632: 628: 627: 624: 621: 618: 614: 613: 610: 607: 604: 600: 599: 596: 593: 590: 586: 585: 578: 575: 572: 568: 567: 564: 559: 556: 543: 540: 461: 454: 452: 449: 409: 408: 390: 364: 346: 321: 315: 309: 299: 289: 275: 263: 260: 259: 258: 248: 242: 230: 227: 169: 166: 100: 99: 94: 88: 87: 82: 81:Type of format 78: 77: 72: 68: 67: 64: 62: 56: 55: 42: 36: 35: 32: 17: 13: 10: 9: 6: 4: 3: 2: 1541: 1530: 1527: 1525: 1522: 1521: 1519: 1509: 1505: 1501: 1497: 1494: 1491: 1488: 1485: 1483: 1480: 1477: 1474: 1473: 1469: 1460: 1454: 1452: 1448: 1443: 1439: 1432: 1429: 1413: 1406: 1400: 1397: 1392: 1386: 1383: 1378: 1374: 1367: 1364: 1349: 1346:(July 1998). 1345: 1339: 1337: 1335: 1333: 1329: 1322: 1318: 1315: 1313: 1310: 1307: 1304: 1302: 1299: 1297: 1294: 1293: 1289: 1287: 1280: 1275: 1272: 1269: 1266: 1263: 1259: 1256: 1252: 1248: 1244: 1243: 1242: 1240: 1231: 1217: 1215: 1213: 1209: 1205: 1197: 1195: 1189: 1187: 1172: 1171:spatial index 1160: 1158: 1155: 1153: 1149: 1143: 1131: 1129: 1122: 1109: 1106: 1103: 1100: 1099: 1095: 1092: 1089: 1086: 1085: 1081: 1079: 1076: 1073: 1070: 1069: 1066: 1052: 1046: 1044: 1038: 1035: 1032: 1029: 1028: 1025: 1023: 1017: 1014: 1011: 1008: 1007: 1004: 1002: 996: 993: 990: 987: 986: 983: 981: 975: 972: 969: 966: 965: 961: 958: 955: 954: 951: 949: 943: 940: 937: 934: 933: 930: 928: 922: 919: 916: 913: 912: 909: 907: 901: 898: 895: 892: 891: 888: 886: 880: 877: 874: 873: 869: 866: 863: 862: 858: 855: 852: 851: 847: 844: 841: 840: 836: 833: 830: 829: 825: 822: 819: 818: 814: 811: 808: 807: 804: 796: 793: 790: 787: 786: 782: 779: 776: 773: 772: 768: 766: 763: 760: 757: 756: 753: 747: 740: 737: 734: 731: 730: 726: 723: 720: 717: 716: 712: 710: 707: 704: 701: 700: 697: 691: 684: 681: 678: 675: 674: 670: 667: 664: 661: 660: 656: 653: 650: 647: 644: 643: 639: 636: 633: 630: 629: 625: 622: 619: 616: 615: 611: 608: 605: 602: 601: 597: 594: 591: 588: 587: 579: 576: 573: 570: 569: 565: 563: 560: 557: 554: 553: 549: 541: 539: 537: 532: 530: 526: 522: 518: 514: 510: 506: 502: 498: 493: 487: 483: 479: 475: 471: 455: 450: 448: 446: 406: 402: 398: 391: 380: 372: 365: 362: 358: 354: 347: 338: 334: 322: 316: 310: 300: 290: 287: 286:spatial index 276: 273: 266: 265: 261: 256: 249: 243: 240: 233: 232: 228: 226: 224: 220: 212: 209:. The actual 207: 195: 191: 187: 181: 179: 175: 167: 165: 163: 159: 155: 151: 147: 143: 139: 135: 131: 127: 123: 119: 115: 111: 107: 98: 95: 93: 89: 86: 83: 79: 76: 73: 69: 63: 61: 57: 43: 41: 37: 30: 25: 16: 1524:Open formats 1441: 1431: 1419:. Retrieved 1412:the original 1405:"SBN Format" 1399: 1385: 1376: 1366: 1354:. Retrieved 1284: 1232: 1221: 1218:Data storage 1212:geodatabases 1201: 1193: 1168: 1156: 1145: 1123: 1115: 1060: 1042: 1041: 1036: 1021: 1020: 1015: 1012:MultiPointM 1000: 999: 994: 979: 978: 973: 947: 946: 941: 938:MultiPointZ 926: 925: 920: 905: 904: 899: 884: 883: 802: 751: 695: 533: 494: 481: 463: 451:File formats 410: 336: 332: 239:content-type 223:8.3 filename 218: 210: 189: 188:. The three 182: 171: 161: 157: 116:as a mostly 105: 103: 15: 1508:AFC Library 1204:topological 1190:Limitations 1033:MultiPatch 867:MultiPoint 505:dimensional 492:extension. 470:binary file 262:Other files 192:files have 178:ArcView GIS 174:topological 162:temperature 142:water wells 1518:Categories 1323:References 1078:Endianness 970:PolylineM 896:PolylineZ 823:Null shape 812:Shape type 765:Endianness 709:Endianness 582:0x0000270a 562:Endianness 445:endianness 383:text/plain 373:(only for 361:XML schema 337:columnname 154:attributes 128:features: 1500:Shapefile 1210:and many 1208:coverages 1037:Mandatory 1016:Mandatory 995:Mandatory 991:PolygonM 974:Mandatory 942:Mandatory 921:Mandatory 917:PolygonZ 900:Mandatory 845:Polyline 509:elevation 401:MapServer 371:code page 359:or other 357:ISO 19115 333:shapefile 211:shapefile 190:mandatory 186:directory 106:shapefile 22:Shapefile 1290:See also 1251:GDAL/OGR 1043:Optional 1001:Optional 980:Optional 962:X, Y, M 948:Optional 927:Optional 906:Optional 885:Optional 856:Polygon 626:Version 529:4D space 513:3D space 405:GDAL/OGR 397:quadtree 349:.shp.xml 168:Overview 138:polygons 92:Standard 1421:21 June 1308:(OSGeo) 1262:Unicode 959:PointM 881:X, Y, Z 878:PointZ 815:Fields 486:AutoCAD 478:records 1356:4 July 1082:Usage 834:Point 780:little 769:Usage 713:Usage 682:little 679:double 668:little 665:double 651:little 648:double 637:little 623:little 566:Usage 548:Header 536:double 474:header 419:, and 203:, and 148:, and 146:rivers 136:, and 130:points 126:vector 1504:Dbase 1498:Java 1415:(PDF) 1408:(PDF) 1351:(PDF) 1247:dBase 1239:dBase 1152:xBase 1148:dBase 1104:int32 1090:int32 1071:Bytes 837:X, Y 826:None 809:Value 777:int32 758:Bytes 735:int32 721:int32 702:Bytes 676:84–99 662:68–83 645:36–67 634:int32 631:32–35 620:int32 617:28–31 606:int32 603:24–27 592:int32 574:int32 555:Bytes 255:dBase 150:lakes 134:lines 1502:and 1423:2023 1358:2007 1344:ESRI 1255:null 1235:.dbf 1228:.dbf 1226:and 1224:.shp 1184:.shp 1180:.sbn 1176:.shp 1163:.sbn 1142:.dbf 1134:.dbf 1126:.shp 1119:.shp 1074:Type 1063:.shp 1055:.shx 887:: M 761:Type 705:Type 589:4–23 558:Type 525:time 490:.shp 466:.shp 458:.shp 441:.shx 439:and 437:.shp 433:.dbf 431:and 429:.shx 425:.shp 421:.dbf 417:.shx 413:.shp 403:and 393:.qix 375:.dbf 367:.cpg 339:.atx 328:.dbf 324:.atx 318:.mxs 312:.ixs 306:.aih 304:and 302:.ain 296:.fbx 294:and 292:.fbn 284:— a 282:.sbx 280:and 278:.sbn 268:.prj 251:.dbf 245:.shx 235:.shp 215:.shp 206:.dbf 201:.shx 197:.shp 158:name 114:Esri 104:The 75:Esri 53:.dbf 49:.shx 45:.shp 1107:big 1101:4–7 1093:big 1087:0–3 774:0–3 738:big 732:4–7 724:big 718:0–3 609:big 595:big 577:big 571:0–3 385:OR 160:or 85:GIS 1520:: 1450:^ 1440:. 1375:. 1331:^ 1030:31 1009:28 988:25 967:23 956:21 935:18 914:15 893:13 875:11 788:4– 584:) 531:. 415:, 351:— 199:, 164:. 144:, 132:, 51:, 47:, 1444:. 1425:. 1393:. 1379:. 1360:. 1165:) 1136:) 1057:) 864:8 853:5 842:3 831:1 820:0 794:– 791:– 460:) 389:} 345:} 335:.

Index


Filename extension
Internet media type
Esri
GIS
Standard
Shapefile Technical Description
data format for geographic information system (GIS) software
Esri
open specification
GIS software products
vector
points
lines
polygons
water wells
rivers
lakes
attributes
topological
ArcView GIS
directory
filename extensions
.dbf
8.3 filename
content-type
dBase
well-known text representation of coordinate reference systems
spatial index
geospatial metadata

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.