Search code examples
iphonegeocodingcgal

CGAL replacement for iOS


I have a set of nodes that define streets. Each node has latitude and longitude. Also I have user location with latitude and longitude. My intention is to build Voronoi diagram for segments defined by each pair of nodes, and then find which node user location is closest to.

Looks like this task can be accomplished with CGAL library. While I'm in the process of compiling it for iOS environment, probably you guys will be able to give links to libs that are already compiled against iOS, or were intended to be used in Objective C environment from the very beginning...

Because I'm afraid that even if CGAL compiles for me, I might get into trouble when using it. Thanks!

P. S. Also probably you have a better solution in mind. Feel free to spell it our here.


Solution

  • I have never used CGAL, so I can't comment on whether or not my solution is better.

    But I have used the spatialite library to do something similar. Spatialite runs on top of sqlite. When you use it, it's better to not use the sqlite library that comes with the iPhone, but simply recompile everything from scratch with spatialite included. Once you have the data in the database, you can use simply functions such as ST_Distance to find the closes segments.

    Spatialite uses R*-Trees for spatial indexing. Lookups are very fast.