简体   繁体   English

ESRI shapefile 选择哪个 C++ 库?

[英]Which C++ library for ESRI shapefiles to choose?

Does anyone have an experience in processing (reading) ESRI shapefiles from C++?有没有人有从 C++ 处理(读取) ESRI shapefile的经验?

I have found at least 2 open source libraries: ShapeLib C library and OGR .我找到了至少 2 个开源库: ShapeLib C 库OGR Which one is better?哪一个更好? Does anybody used one of them?有人用过其中一种吗? How about the experience?体验如何?

The OGR Shapefile driver from GDAL/OGR directly uses implementation of Shapelib, so there is no difference actually. GDAL/OGROGR Shapefile驱动直接使用Shapelib的实现,所以实际上没有区别。 If you check the OGR source tree, you will find Shapelib files like shpopen.c and dbfopen.c .如果你检查 OGR 源代码树,你会发现像shpopen.c 和 dbfopen.c这样的 Shapelib 文件。

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.此外, Frank Warmerdam是 Shapelib 和 OGR 的作者,我可以确认 Frank 使 shpopen.c 和 dbfopen.c 在 Shapelib 和 OGR 之间保持同步。

To summary, there is no difference between Shapelib and OGR regarding the implementation of Shapefile format specification.综上所述,Shapelib 和 OGR 在实现 Shapefile 格式规范方面没有区别。

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.我发现它们都很好,但我会选择 ShapeLib 库,因为 ogr 的目的有点沉重/奇怪。

The shapefile format is very simple; shapefile 格式非常简单; 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.如果您只需要访问一组特定/简单的 shapefile,您可以考虑重新发明轮子并编写代码来自己访问它们。 I've done this in an embedded app and it didn't take much more time then using these libs.我已经在嵌入式应用程序中完成了这项工作,并且使用这些库并没有花费太多时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM