Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

first post - new to GIS.

My understanding of shapefiles is that they are (contain?) featureclasses, that contain features (points, polylines, polygons). Is there a clear hierarchy for these files. Would the next level after features be individual points? Are polygons and polylines merely point collections? What implication does this have for working with the data - e.g. can all geometries be worked with at the "point" level?

Is there a resource that would help me to understand the data structure and/or object model of these files? What I am essentially looking for is an explanation as to what exactly shapefiles are and what I should know when working with them, especially when using ArcObjects. In addition to this - how does this relate to other software like QGIS? Do they operate in the same way?

Thank you!

Joe

share|improve this question
1  
"What I am essentially looking for is an explanation as to .. what I should know when working with them, especially when using ArcObjects" - can you provide more info on what you expect to be doing with the shapefiles? –  Stephen Lead Aug 9 '11 at 1:32
1  
I wont try to explain all of it since everyone is jumping on this. What I will tell you is that a Shapefile is a storage format for spatial data that conforms to the OGC Simple Features Specification. Contrary to popular belief, The GeoDatabase is not a spatial format... it is an information model that specifies how various spatially-enabled object-relational entities interact with each other (FeatureClasses, network datasets, topologies,etc). There are various implementations of that model (Personal GDB, FileGDB, Enterprise (ArcSDE) GDB. The rest, I will leave for others :) –  Ragi Yaser Burhum Aug 9 '11 at 4:36
    
I find it helpful use the formal definitions of Is-a and Has-a for these sorts of questions. –  Kirk Kuykendall Aug 9 '11 at 17:37
    
Expansing on my comment above, I guess I also would like to emphasize that there is not such a thing as a "GeoDatabase storage format." Nevertheless Personal GDB, FileGDB are file-based GDB-compliant storage formats. Even ppl at ESRI make the mistake of not doing the distinction all the time. –  Ragi Yaser Burhum Aug 10 '11 at 4:40
add comment

5 Answers 5

The help file entry for featureclasses may be a good place to start. Here's my take on this:

> My understanding of shapefiles is that they are (contain?) featureclasses

A featureclass is a collection of features of the same geometry type (such as polygon, point, line, etc) so a shapefile is an example of a featureclass (a featureclass may be physically stored on disk in a number of formats, including the shapefile).

Each shapefile can contain only one geometry type, so the shapefile can be defined as storing polygons OR lines OR points.

(The newer geodatabase storage format can contain multiple featureclasses, so a single geodatabase may contain points AND lines AND polygons - but each geometry type will still be stored in a separate featureclass. An advantage of the geodatabase is the ability to manage relationships between the featureclasses, such as maintaining coincident boundaries, preventing overlaps, etc. This isn't possible (at the database level) when using a shapefile without writing some process yourself).

> that contain features (points, polylines, polygons).

That's correct - a shapefile contains features. Note that a single featureclass can contain only points OR lines OR polygons.

> Is there a clear hierarchy for these files? Would the next level after features be individual points?

Not individual points as such, but individual coordinates. A point is a single XY coordinate. A line is a series of XY coordinates joined together. A polygon is a series of XY coordinates which form an enclosed ring.

Are polygons and polylines merely point collections? What implication does this have for working with the data - e.g. can all geometries be worked with at the "point" level?

Depending on what you are trying to achieve, you may want to work with geometries at the coordinate level. This is possible using ArcObjects - the iGeometry interface may be a good place to start.

The shapefile is an outdated format, and if you're working exclusively with ArcGIS you may be better off learning about the geodatabase. The help file here explains the geodatabase in more detail.

share|improve this answer
2  
+1, the sooner shapefile goes away the better. Too bad there's not a single definitive open source format to replace it. Regarding topologies, it is possible to use map topologies with shapefiles, which is a lesser-featured form of geodatabase topologies. –  blah238 Aug 9 '11 at 2:08
    
good point, I added "This isn't possible (at the database level) when using a shapefile" to clarify –  Stephen Lead Aug 9 '11 at 3:27
add comment

In the ESRI world, a shapefile is a file-based feature class. Feature classes can also be stored in geodatabases. A shapefile does not contain feature classes, rather, it contains features, which are made up of parts, which are in turn made up of vertices. A point feature class, for example, has one part per feature, and one vertex per part. The higher order geometry types can be more complex.

Images of a multi-part polygon (donut hole in middle) and one with the inner part removed

For example, on the left you have a multipart polygon. The middle shows the vertices of the parts, and the right shows what happens when the inner part is deleted. You can also have non-overlapping parts that belong to the same feature, such as:

Image of Hawaii with caption: The state of Hawaii is often represented as a multipart feature

As for working with ArcObjects, for the most part a shapefile feature class works the same in ArcObjects as any other feature class. The main differences are that shapefiles use a different workspace factory, have an 10 character field name limit, and have potentially have less coordinate precision than geodatabase feature classes.

If you have specific ArcObjects questions, I would suggest first reading through the documentation, the samples, searching this and the ESRI ArcObjects forums (new) and (old), and of course asking questions if you still need help.

share|improve this answer
    
"for the most part a shapefile feature class works the same in ArcObjects as any other feature class" - that's a good point. As far as the end-user is concerned, the actual storage mechanism shouldn't really matter. ArcGIS does a (mostly) good job of nullifying the differences between the storage formats, so a featureclass is a featureclass –  Stephen Lead Aug 9 '11 at 1:57
    
Yup, the main thing you have to worry about is SQL syntax for example if you need to write a whereclause for a cursor, and when adding fields making sure they are <= 10 characters. For the SQL syntax part see this question –  blah238 Aug 9 '11 at 2:03
    
yep, that's mostly what I meant by "mostly" :) –  Stephen Lead Aug 9 '11 at 3:22
1  
You left out one very important difference between shapefiles and other feature classes. Shapefiles cannot store true curves. For applications where this matters, it completely rules out shapefiles as a storage format. –  blord-castillo Aug 9 '11 at 12:34
add comment

This is how I understand the situation for ArcGIS:

The basic unit of vector data in ArcGIS is the feature. Features come in three basic flavours - point, line and polygon. A point is simply a set of co-ordinates; a line is a set of points joined in a particular order; a polygon is a set of points joined in a particular order where the start and end co-ordinates are the same (i.e. the line is closed). Polygons also have support for interior and exterior rings, so that you can have polygons with holes in.

Features are grouped into feature classes: a feature class is a collection of features with the same co-ordinate system and geometry type. Feature classes have an associated attribute table where each row of the table corresponds to a single feature. This table will have a "Shape" column which stores all of the spatial information associated with each feature, and it may also have additional columns to store other data on a feature-by-feature basis. ArcObjects allows you (amongst other things) to access the information in this table, including the spatial details "hidden" in the Shape column.

Feature classes sharing the same co-ordinate system (and a few other properties) can be grouped together into feature datasets. This is optional.

Finally, feature classes and/or feature datasets are stored in a geodatabase, which offers a relational DBMS for your spatial data. This means that you can define relationships between your various feature classes and govern how they interact with one another (plus lots and lots of other stuff). There are different types of geodatabase, the simplest being the Personal Geodatabase (essentially a MS Access database) and the File Geodatabase. There's also ArcSDE, which offers proper client-server geodatabase functionality.

A shapefile is basically the stand-alone equivalent of a feature class: they're collections of features with the same co-ordinate system and geometry type. They also have attribute tables, just like feature classes. Unlike feature classes, shapefiles can exist outside of the geodatabase environment and their self-contained nature has made them a very common format for exchanging spatial data. However, because they exist outside of a relational DBMS, shapefiles are very limited when it comes to working with multiple datasets and controlling their interactions.

In summary, the hierarchy for ArcGIS looks something like this:

In a RDBMS: Geodatabase > Feature dataset [optional] > Feature class > Feature
No RDBMS:                                                Shapefile   > Feature

Other software

I'm less clear on this, but I believe the situation is similar for most other GIS software (e.g. QGIS). Some packages do have their own native file types similar to the shapefile, but shapefiles are so common that most packages will work directly with them as well. For geodatabases, you have a few options available:

spatialite is a great personal geodatabase. I suppose it's the nearest open-source equivalent to an ESRI Personal Geodatabase (? but please correct me if I'm wrong; the comparison doesn't seem right, somehow). Spatialite defines various point, line and polygon geometries (as above) and the spatial information for each feature is stored in the "Geometry" column of a spatialite table (also as above). You can easily import/export shapefiles to/from your spatialite database.

If you need a full, open-source, client-server geodatabase, then PostGIS is likely to be a good option.

For these geodatabases, the hierarchy isn't quite the same as above. A spatialite database contains tables and, just like feature class attribute tables, these tables contain the features (one per row). Concepts like "feature class" and "feature dataset" don't really apply in spatialite, and I suspect this is also the case for postGIS (?).

share|improve this answer
    
This is a great description of features, featureclasses, etc. It's arguably better than the ArcGIS Help files. This should be included in the intro training courses! –  Stephen Lead Aug 10 '11 at 5:02
add comment

While there has been a lot of discussion of the shapefile here, some key feature class weaknesses are still missing.

Shapefiles cannot store true curves.

Shapefile geometry is not topologically correct (there is no guarantee that polygon edges with the same coordinates will not overlap because no edge information is stored). No topology is stored in a shapefile.

Shapefiles cannot store measures. Although you can define m-values at vertices, no measures are maintained between vertices. There is not much need for this of course without curves.

Null shapes in shapefiles do not carry a type.

share|improve this answer
add comment

That's a loaded question! You can get the basic concepts you're asking about at ESRI ArcGIS resource centre. Here's a site for QGIS and you can learn about ArcObjects at THIS LINK.

There's a lot of information at these links.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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