15

Does anyone have an experience in processing (reading) ESRI shapefiles from C++?

I have found at least 2 open source libraries: ShapeLib C library and OGR. Which one is better? Does anybody used one of them? How about the experience?

2 Answers 2

23

The OGR Shapefile driver from GDAL/OGR directly uses implementation of Shapelib, so there is no difference actually. If you check the OGR source tree, you will find Shapelib files like shpopen.c and dbfopen.c.

Also, Frank Warmerdam is the author of both, Shapelib and OGR and I can confirm myself that Frank keeps the shpopen.c and dbfopen.c in synch between Shapelib and OGR.

To summary, there is no difference between Shapelib and OGR regarding the implementation of Shapefile format specification.

10

I've found them both to be ok, but I'd choose the ShapeLib library as ogr is a bit heavy/weird for its purpose.

The shapefile format is very simple; if you only have to access a specific/simple set of shapefiles you could consider reinventing the wheel and write the code to access them yourself. I've done this in an embedded app and it didn't take much more time then using these libs.

3
  • Decided to use ShapeLib, thank you very much. In our case, it makes no sense to redevelop a code that has been already tested with wide variety of applications using the lib. Jan 27, 2010 at 7:01
  • Hi, sorry for my questions, just want know how to render the shapefiles ? I meaning is draw the map data ? any open source code can be use for this purpose ? Thanks for your reply . Regards
    – iXcoder
    May 15, 2010 at 8:43
  • @Robin, your best bet to getting an answer to this question is to search the internet. The next best bet is to post this as a separate question - comments are not the appropriate place to begin a new line of inquiry.
    – Richard
    Nov 6, 2012 at 12:54

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.