5

enter image description here

I received this folder from a county's GIS department. Am I right in telling them that there is nothing in it? They seem convinced that everything is included, but all I see is that there is Metadata associated with the Shapefile that isn't contained within the Shapefile itself. Am I doing something wrong or is the fault on their end?

2
  • 1
    Actual byte counts would be more useful than a picture of the kilobytes. An empty shapefile will have 100-byte .shp and .shx -- the .dbf length would depend on the number of attributes (32*(nFields+1))
    – Vince
    Commented Jun 4, 2016 at 17:46
  • Are you refer it that they send the files to you in xml ?
    – PROBERT
    Commented Jun 5, 2016 at 2:06

5 Answers 5

5

In the OSGeo4W Shell, you can run

 ogrinfo -al -so Centerlines.shp

To get the Feature Count of a shapefile. If it is zero, there is nothing to display.

4

First, the 1KB is Windows Explorer rounding to a lower bound. If you use dir (or ls -l in OSGeo4W, you will see file sizes in bytes of less than 1024.

Second, this file can contain data. I created a new point shapefile and added exactly one feature. The only attribute columns are default ID columns. I did not create metadata, so there is no *.shp.xml file. However, all other files (SHP, DBF, SHX, etc.) are created. In Windows Explorer, they all appear to have a file size of 1KB. However, ls -l produces the following:

-rw-r--r-- 1 CLASMRT Administrators     5 Jun  4 15:56 temp.cpg
-rw-r--r-- 1 CLASMRT Administrators    73 Jun  4 15:56 temp.dbf
-rw-r--r-- 1 CLASMRT Administrators   562 Jun  4 15:55 temp.prj
-rw-r--r-- 1 CLASMRT Administrators   148 Jun  4 15:56 temp.sbn
-rw-r--r-- 1 CLASMRT Administrators   116 Jun  4 15:56 temp.sbx
-rw-r--r-- 1 CLASMRT Administrators   128 Jun  4 15:56 temp.shp
-rw-r--r-- 1 CLASMRT Administrators   108 Jun  4 15:56 temp.shx

So, if there are a small number of features and few attributes, the file sizes would be very small. Note however, that if there are no features, the file sizes are still not zero bytes, so you cannot confirm that it is not empty based on file size.

If you load in ArcMap or QGIS, you should be able to open the attribute table. If there are no rows, there is no data. You can also use ogrinfo (if you have OSGeo4W installed). As given by AndreJ, the command is:

ogrinfo -al -so Centerlines.shp

But this shouldn't give you any more information than you get by opening the attribute table in QGIS or ArcGIS.

2
  • 1
    Yes, you can confirm that a shapefile is empty based on file size: If the .shp/.shx files are exactly 100 bytes (if one is 100 and the other isn't, then it's corrupt)
    – Vince
    Commented Jun 4, 2016 at 21:08
  • That's useful information. I'm not going to be able to test until Monday, and will update my answer them. Commented Jun 5, 2016 at 4:57
1

That looks fine to me. A shapefile consists of a bunch of files (despite the name) of which there must be a .shp, .dbf and .shx files. Often you will get a .prj, .sbn & .xml files to bu they are not necessary.

5
  • 3
    But all of the files are 1 KB. If I try to open the shapefile it just shows up as a layer with nothing in it. The categories are there in the attribute table but there are no features.
    – H. Rigsby
    Commented Jun 4, 2016 at 17:07
  • 1KB is probably enough for a very small number of very small features with a very small number of attributes. But if you are expecting more than that then you haven't got it. Do have a quick look at that huge XML file though. I doubt its data, its probably more metadata...
    – Spacedman
    Commented Jun 4, 2016 at 17:44
  • Do you know what kind of data should be in this .shp file ? Try to open .dbf file in Excel and look if something is there ?
    – Artec
    Commented Jun 4, 2016 at 18:37
  • Right. It's supposed to be about 2 square miles of structures and road centerlines. I don't think it's contained in these files. The shapefile has all of the necessary attribute fields, but no features as far as I can tell.
    – H. Rigsby
    Commented Jun 5, 2016 at 16:27
  • Probably you transferred incomplete source data. Please contact your provider. For example ask for a different data format.
    – Artec
    Commented Jun 5, 2016 at 20:27
1

If you have a license for ArcGIS Advanced ,Could you export them to geodatabase and see if it shows up ? Worth to try and check..

Or you can run Check Geometry for any problems with the shapefile. Here is the information you can read about it. http://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/check-geometry.htm

0

The easiest way to check for data in a shapefile if you don't have GIS software handy is to open the shapefile's DBF file with Excel.

For example, I have created a shapefile and added a field to it, but created no features.

In the Excel Open dialogue you need to change the Type drop-down to dBase File

enter image description here

And the file open in Excel shows a couple of field names but no data (nothing in row 2 etc.)

enter image description here

If I then go and open the shapefile in ArcMap and add a few features (and still no attribution just to show the effect)

enter image description here

and reopen in Excel you can now see there are some rows showing in the DBF file.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.