mapbox / geojson-cpp

A C++14 library for converting GeoJSON into geometry.hpp representation
ISC License
68 stars 27 forks source link

Generic Types and Header Only #27

Open flippmoke opened 7 years ago

flippmoke commented 7 years ago

While exploring this library, I noticed two things that I would like to change -- but might be viewed as larger changes to the library.

First, I would like to make the library more generic such that it would output all geometry<T> types rather then just geometry<double>. As part of these changes I would like to also make the library header only -- we could get away with not doing this and simply defining the types specifically outside the impl file, but I could prefer it to simply be header only and if there are compile time issues let the implementing library solve this problem by encapsulating the use of the library.

/cc @jfirebaugh @kkaefer

kkaefer commented 7 years ago

FWIW, we are already using this as a header-only library in Mapbox GL: https://github.com/mapbox/geojson-cpp/pull/24

flippmoke commented 7 years ago

@kkaefer I would prefer to simply make it geojson.hpp and drop the geojson_impl.hpp

jfirebaugh commented 7 years ago

The drawback to making it header only is that it then requires the downstream library to depend on and provide rapidjson.

May I ask why you want support for coordinate types other than double?

flippmoke commented 7 years ago

@jfirebaugh I would like to use std::int64_t for situations where it is well known that the geojson will not be anything but whole numbers. This could be an intermediate format during a map reduce type processing for creation of vector tiles.