Skip to content
This repository was archived by the owner on Jun 4, 2026. It is now read-only.
This repository was archived by the owner on Jun 4, 2026. It is now read-only.

Converting from geometry.hpp to internal representation #40

Closed

Description

@mourner

Currently, convert.cpp code converts from GeoJSON data in RapidJSON representation to GeoJSON-VT internal representation, which is implemented using Projected* types (basically, OGC features with a third coordinate for simplification value + bounding boxes, and additionally storing polygon area + line length for each linear ring).

To switch to a geometry.hpp-powered GeoJSON-VT-C++ in Mapbox GL Native, we need to make it possible to create GeoJSON-VT index from structures in the code directly, without the GeoJSON step. Currently this is done in hacky way by exposing Projected* classes from GeoJSON-VT and then reconstructing them in https://github.com/mapbox/mapbox-gl-native/blob/master/src/mbgl/annotation/shape_annotation_impl.cpp.

Instead we would need to either have separate convert_geojson and convert_geometry code paths, or just fully ditch GeoJSON conversion and only accept geometry.hpp for the input, moving the GeoJSON parsing responsibility to GL Native.

cc @artemp @jfirebaugh

Activity

  1. artemp commented on May 4, 2016

    @artemp
    Contributor

    @mourner - I thinks taking GeoJSON specific stuff out is a smart move, yes ^

  2. mourner commented on May 4, 2016

    @mourner
    MemberAuthor

    Per chat, @kkaefer suggests making mapbox/geojson.hpp that converts from GeoJSON to geometry.hpp representation, and then switch to that in gl-native while ditching GeoJSON code from this repo. Sounds like a great plan.

  3. reopened this on May 4, 2016
  4. mourner commented on May 4, 2016

    @mourner
    MemberAuthor

    Here's a rough bullet list of things that need to be done, per chat with @springmeyer:

    • create a mapbox/geojson.hpp library that converts raw GeoJSON data to geometry.hpp (would be similar to convert.cpp code)
    • ditch GeoJSON conversion code from this repo and make geometry.hpp representation the input
    • hide all Projected* classes and converFeatures static method from public API
    • make GeoJSONVT index creation a one-step process again (accepting geometry.hpp in constructor instead of ProjectedFeature vector generated by convertFeatures)
    • switch GL Native to use geojson.hpp for GeoJSON parsing and switch to new geojson-vt-cpp with geometry.hpp input
    • switch GL Native shape annotations implementation to use geometry.hpp representation instead of using Projected*
    • update remaining types in types.hpp to use geometry.hpp — Feature, Tags, etc.
    • if possible, update internal Projected* classes to reuse as much geometry.hpp as possible (relies on 3rd coord, etc.)
  5. self-assigned this
    on May 25, 2016
  6. kkaefer commented on Jun 28, 2016

    @kkaefer
    Member

    🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions