Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

features #8

Closed
jfirebaugh opened this issue Apr 13, 2016 · 3 comments
Closed

features #8

jfirebaugh opened this issue Apr 13, 2016 · 3 comments

Comments

@jfirebaugh
Copy link
Contributor

Several use cases for this library will also require a feature representation: geometry plus properties.

A basic sketch of the necessary types would be:

using value = mapbox::util::variant<bool, int64_t, uint64_t, double, std::string>;
using property_map = std::unordered_map<std::string, value>;

template <class T>
struct feature
{
    property_map properties;
    geometry<T> geometry;
};

template <class T, template <typename...> class collection>
struct feature_collection : collection<feature<T>>
{
    using collection_type = collection<feature<T>>;
    using collection_type::collection_type;
};
@ansis
Copy link

ansis commented Apr 13, 2016

Should object and array property values be supported?
Or would json arrays be stored in stringified form?
slightly related: mapbox/mapbox-gl-js#2434

@artemp
Copy link
Contributor

artemp commented Apr 18, 2016

@ansis - we can and should store recursive types via variant::recursive_wrapper<T>
@jfirebaugh - feature sketch looks like a good start. I'm wondering why distinguish between signed and unsigned, though? /cc @kkaefer ?

@jfirebaugh
Copy link
Contributor Author

@artemp The JSON specification does not limit the size of integers, so it's useful to expose both signed and unsigned 64-bit integers to cover the widest possible range. This also follows the vector tile spec, existing convention in mapbox-gl-native, and what rapidjson exposes.

This was referenced Apr 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants