As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened,
visit the help center for guidance.
Closed 7 years ago.
What are some recommended frameworks for manipulating spatial data in C++?
I'm looking for a polygon object, point object, and some operations like union, intersection, distance, and area. I need to enter coordinates in WGS84 (lon,lat) and get area in square km.
I would prefer a free/open source framework, but am open to suggestions.
Edit: Unfortunately I need a non-GPL solution. LGPL is alright.
GEOS is an open source (LGPL) C++ geometry / topology engine. Might suit you?
Useful places to look for this stuff are this useful article on the O'Reilly website and also OSGeo which is a collaboration to support open source geospatial stuff.
I also recommend Generic Geometry Library which recently has been reviewed and eventually accepted to the collection of Boost C++ Libraries. As included in Boost, the GGL is now called Boost.Geometry, more precisely Boost.Geometry aka GGL, Generic Geometry Library.
Other useful tools
- ORFEO Toolbox (aka OTB) - a library of image processing algorithm
- MetaCRS - a project encompassing several projections, and coordinate system related technologies.
- libgeotiff for sole GeoTIFF manipulation
GEOS for the Geometry model, and GDAL/OGR for a spatial data abstraction library which supports Rasters and Vectors.
By using these libraries, you will also be able to handle different coordinate systems (like transforming from/to WGS84) since both of them use Proj.4 under the hood. To find distances in meters you can transform from WGS84 to something that uses meters like UTM.
Depending on how complex these calculations are going to be you might want to consider writing your own. If you are just doing area that might be your best option for speed and lack of bloat.
otherwise the Geographic Foundation Class (GFC) library is your best bet.
It's not comprehensive and high-level enough for what you asked, but for doing geodetic transforms you can use the NGA's excellent GEOTRANS library:
http://earth-info.nga.mil/GandG/geotrans/
That will let you convert between things like WGS84 lat/long and a local cartesian coordinate system. The C code is well tested, documented, and is public domain.