Shapefile with ObjectiveC

牧云@^-^@ 提交于 2019-12-10 04:04:45

问题


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


回答1:


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.




回答2:


See the Shapelib Libarary It's written in C, but is usable in Objective-C, as OBJ-C is a superset of C :)



来源:https://stackoverflow.com/questions/5891448/shapefile-with-objectivec

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!