使用 ObjectiveC 的 Shapefile
我想知道 Objective-C 中是否有一个类可以操作 shapefile(读/写/编辑)?
我在 kml 文件上找到了很多东西,但没有找到有关 shp 文件的信息,但绝对希望避免转换文件格式的需要(shp-> kml)。
谢谢
I like to know if there is a Class, in objective-C, that manipulates shapefile (read/write/edit)?
I have found a bunch of stuff on kml files but nothing about shp files, but definitely want to avoid the need of converting files format (shp->kml).
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Pascal Brandt 有一个,...(有点简单,但对我来说确实有用)... CocoaShapeFile。他只是给 C 函数穿上了 Objective-C 的外衣,但它对于阅读来说效果很好。如果您使用 iOS 而不是 Cocoa 进行拍摄,那么您只需自己进行一些转码/转换即可。
只需一点点努力,我就能让它在 iPad 上运行,使用 MapKit,并使用引用计数而不是垃圾收集(在 iOS 上不可用)。
为了可能减轻你的痛苦(当然,我不知道你打算用 shapefile 做什么),但我发布了一个快速而肮脏的 git 存储库,iOS-Shapefile,向您展示如何将 shapefile 形状(如点和多边形/折线)获取到 iOS MKMapView 中。
至于写作和编辑(因为这超出了我的兴趣),我认为您可能必须采用自己的方法,偏离我在这里提供的方法。
There's one from Pascal Brandt, ... (it's a little simplistic, but it certainly does the trick for me) ... CocoaShapeFile. He's just dressed up the C functions in Objective-C clothes, but it works just fine for reading. If you're shooting for iOS instead of Cocoa then you'll have to do just a little transcoding/conversion yourself.
With only a little bit of effort, I was able to get it running on the iPad, using MapKit, and using reference counting instead of garbage collection (not available on iOS).
To potentially ease your pain a little (granted, I don't know what you plan to do with shapefiles), but I've released a quick and dirty git repository, iOS-Shapefile, that shows you how to get shapefile shapes (like points and polygons/polylines) into an iOS MKMapView.
As for writing and editing, (since that was beyond my interest), I think you'll likely have to roll your own methods, deviating from what I've provided here.
请参阅 Shapelib 库 它是用 C 编写的,但可以在 Objective-C 中使用,因为 OBJ-C 是一个超集C :)
See the Shapelib Libarary It's written in C, but is usable in Objective-C, as OBJ-C is a superset of C :)