Ag Geek Speak

17.5 Tiny Bytes: What Makes a Shapefile?

A Podcast for Precision Agriculture Geeks Season 1 Episode 17

Ever wondered why your shapefiles have more than one file? Discover the critical components that make up a shapefile and why each one is essential for accurate GIS and Precision Agriculture tasks. In this episode, we unpack the mystery behind shapefiles, explaining the roles of the four crucial files: .shp, .shx, .dbf, and .prj. Learn how these files collaborate to manage geometry, position, attributes, and projections, ensuring your data is complete and functional.

Say goodbye to shapefile confusion and hello to streamlined GIS tasks with confidence! Tune in to elevate your understanding and application of shapefiles.

Cover art meme from: https://www.reddit.com/r/gis/comments/1c2dhc0/this_still_happens_to_others_too_right/

Sound effects in this episode from: https://pixabay.com/sound-effects/livechat-129007/ and https://pixabay.com/sound-effects/censor-beep-88052/

Jodi:

And now it's time for a tiny bite of knowledge. Hey Sarah, could you send me that shape file over?

Sarah:

Absolutely. I'll get you that prescription right away, sarah. Yes, I can't just have the dot SHP.

Jodi:

Sarah, yes, I can't just have the shp, I need the whole shapefile.

Sarah:

What do you mean? The whole shapefile. Today, on this little tiny bite, we are going to talk about what is a shapefile, because we run into this all the time, Jodi what is a shapefile?

Jodi:

A shapefile is a vector file format that's commonly used in GIS and Precision Ag. If you're anybody that does anything with yield data any sort of Precision Ag stuff you've probably heard about shapefiles before.

Sarah:

Okay, and often we find shapefiles are handling items then like points lines, boundaries, are handling items then like points lines, boundaries, polygons, prescriptions, raw yield data. But what really makes up a shapefile?

Jodi:

So there's four different files that make up a shapefile, and I think this is the part that gets confusing right, because I think typically for us, like non-supercomputer users, we think of a file as being one thing and not other parts, but when it comes to shapefiles, one single shapefile is made up of four different files, and I'm just going to list them out, not going to go into detail, but typically these include the shp, the shx, the dbf or the database, and then, in some of the newer formats, the prj or the projection as to where the file is.

Sarah:

That's correct. So the shp is the actual shape file and what that contains is the actual geometry of the object that's getting exported out. The shx is the shape index format that is really carrying the positional information for that object. Where is the location of the object? The dbf contains all of the attribute data. Rates for your prescription are held, or your yield data, or the elevation for the topography at each individual point, each individual GPS coordinate. So at that coordinate this is the attribute value and the PRJ file is the projection file. In other words, how on the earth is this object projected? The earth is round and when we think of maps we think of maps as flat, and so somehow we have to get that object projected from a flat map onto a round earth and that is the information that tells the shapefile how it is projected. But I think we need to back up and talk just for a second about the database file, because it really is quite an interesting item in a shapefile. It contains, again, all of the attribute information.

Jodi:

So backing up what that database file refers to is like if you're working in ADMS and working with a drawing in layer, so a vector file, a shapefile, like we're discussing here, what you'll notice is that you have the option to look at a database, and so what that database in ADMS is showing is this data here, all of that data that's in the dbf. If you think about it, it kind of looks like an Excel table, right, you've got columns, you've got rows of data. That's what is in the dbf. Is it's giving? It's telling the vector file what data is located where in the file.

Sarah:

As we know, vector files can have more than one attribute associated with it, and all of those attributes are contained in the database file. Again, that's where you're going to find anything that was logged. For example, you might have as applied planter rate data along with the prescription that actually went into the controller. You might have elevation data, you might have down pressure data. All of that's going to come in in a separate column for each attribute. That is the information that is contained in the database, and the database also contains, and will tell you, how many polygons are associated with your shapefile as well.

Jodi:

Like we alluded to at the top of the show, it's really important to include all all three or four of these file types when you're moving shapefiles around. If somebody wants a shapefile from you and you only send them one of the four file types for example, if you just send them the shp they most likely will not be able to use that file. They need all different file types, all four of those file types the shp, the shx, the dbf and the prj in order to actually use that file and they all must be named exactly the same.

Sarah:

So be very careful within your software. If you're going to rename one of these files, they absolutely have to have exactly the same name, exactly the same spacing, exactly the same very case sensitive with the letters as well. So I always rename my shapefiles actually within the ADMS software itself, because that will automatically rename every single file that is associated with that shapefile. But shapefiles are a very powerful way of delivering data and working with data and a very common file format that we run into in precision agriculture all the time.

Jodi:

And avoid the cussing when you're working with shapefiles and send all four file formats when you're working with them.

Sarah:

With that at GK Technology we've got a map and an app for that.

Jodi:

Tune in next time for a tiny bite of knowledge from GK Technology.