-
Notifications
You must be signed in to change notification settings - Fork 4
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
Support geojson as a valid source #145
Comments
Two things impacting this:
|
From @incanus via chat:
|
@incanus @mikemorris @bsudekum i know this is totally scope creeping this issue, but it would be very useful from the perspective of app to have built-in support for geojson sources in the static API. A Mapbox gl style template could be designed to render the simplestyle spec (in the same way we use a style template to translate vector tiles into the xray style) but that would be a relatively simple problem that would depend on node-mbgl or gl-native to treat geojson sources the same way it treats vector tile sources. How would this look: In a style, user can define a variable geojson source that would look something like: var style = {
"version": 7,
"name": "overlaysource",
"sources": {
"dynamicgeojsonsource": {
"type": "geojson",
"data": VariableDataThatUserPassesIn
}
},
"sprite": "https://www.mapbox.com/mapbox-gl-styles/sprites/sprite",
"glyphs": "mapbox://fonts/v1/saman-staging/{fontstack}/{range}.pbf",
"layers": [
{
"id": "markers",
"type": "symbol",
"source": "markers",
"layout": {
"text-field": "{title}"
}
}
]
} Then, it is just up to the user to know the kind of data they're going to pass in to the style (most likely via a querystring parameter like our old static API) and then write style layers to match the data. In this |
In response to:
and:
To square these two statements, there’s nothing stopping us from implementing GeoJSON parsing in node-mapbox-gl-native and transforming it into the data structures expected by mbgl’s existing annotation support. This would have to be platform-specific code anyways, because GeoJSON is stored in a different data type on each platform. On iOS, where GeoJSON is not a native data type (but is used by some system frameworks), it is deserialized as an |
Is this true? Wouldn't we build a classic C++ class system with analogs for GeoJSON types, just like we've built for vector tile types? |
Yes – in fact, we already have most of the analogues already in mbgl, in the form of |
I'm very sorry I didn't have time to look at this yet, but it could be workarounded by using |
This repository is on the path to deprecation #151 - @mikemorris should we open an equivalent ticket over at mapbox-gl-native? |
This discussion of on-the-fly annotation versus design-time GeoJSON source support should be continued in https://github.com/mapbox/mapbox-gl-native |
Can you open a ticket there to connect the conversations? |
Opened mapbox/mapbox-gl-native#2161. |
Now that mapbox-gl-native supports shapes, we should add the ability to render geojson when added as a source in stylesheet.
Feeding node-mapbox-gl-native with the (valid) style below fails with the following error:
/cc @tmpsantos @mikemorris @1ec5 @incanus
The text was updated successfully, but these errors were encountered: