Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using SharpMap 2.0, and I'm successfully loading a shapefile and parsing through it. The particular shape file that I'm working with has about 700 polygons in it, and each of those polygons has meta data associated with it (the meta data is in the .DBF file).

How can I get at the meta data for each polygon? I'm not seeing any methods that allow access to this data...

I've searched Google, these forums and have pretty much exhausted my resources trying to figure this one out.

Any help would be greatly appreciated!

Thanks, Jason

share|improve this question

The geometry and attributes should be linked. If you already have the FeatureDataRow object then try getting attribute values with row["ATTRIBUTE_NAME"]

If you can't actually get a FeatureDataRow object have a look at the How do I return a set of feature attribute data from a click on a map? page, but you will need to use SharpMap.Data.Providers.ShapeFile rather than SharpMap.Providers.PostGIS

The following code shows how to get a set of features from a datasource:

  SharpMap.Geometries.Point p = mapImage1.Map.ImageToWorld(e.Location); //could be any point geometry
  FeatureDataSet ds = new FeatureDataSet();

  //example uses a map image, but this could be a layer generated with code
  mapImage1.Layers[0].DataSource.ExecuteIntersectionQuery(p.GetBoundingBox(), ds);
  FeatureDataTable dt = ds.Tables[0];
  FeatureDataRow row = dt.Rows[0];

Then you should be able to access values with row["ATTRIBUTE_NAME"]

share|improve this answer

If I understand your question you may not be looking fo rmetadata but attribute data. I am not familiar with sharpmap. but the data in the dbf is the attribute infomration. the oid is associated with each object and relates it to the shape , and the index (if it exists). In my software I simply select the layer name a right click to open attribute table I know in qgis it is a simiar process. The relationship is already established. Am I off base?

share|improve this answer

Your Answer


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.