Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shapefile with ObjectiveC

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

like image 410
shadowing Avatar asked May 05 '11 00:05

shadowing


1 Answers

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.

like image 150
Greg Combs Avatar answered Nov 16 '22 03:11

Greg Combs