-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
(not ready) Update examples for inline sources #3901
Conversation
@@ -21,15 +21,15 @@ | |||
|
|||
// Add a new source from our GeoJSON data and set the | |||
// 'cluster' option to true. | |||
map.addSource("earthquakes", { | |||
var earthquakes = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should change examples such as this, where multiple layers use a single source.
// Add a GeoJSON source containing place coordinates and information. | ||
map.addSource("places", { | ||
// Declare a GeoJSON source containing place coordinates and information. | ||
var places = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's inline the data rather than use a variable.
// Add a GeoJSON source containing place coordinates and information. | ||
map.addSource("places", { | ||
// Declare a GeoJSON source containing place coordinates and information. | ||
var places = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
@@ -21,11 +21,10 @@ | |||
map.getSource('drone').setData(url); | |||
}, 2000); | |||
|
|||
map.addSource('drone', { type: 'geojson', data: url }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example uses map.getSource(...)
. I think it's clearer with the explicitly parallel addSource
.
@@ -136,11 +136,6 @@ | |||
}); | |||
|
|||
map.on('load', function() { | |||
// Add a GeoJSON source containing place coordinates and information. | |||
map.addSource("places", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example adds multiple layers using this source; keep the explicit addSource
.
@@ -33,17 +33,16 @@ | |||
// After the map style has loaded on the page, add a source layer and default | |||
// styling for a single point. | |||
map.on('load', function() { | |||
map.addSource('single-point', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep, for parallelism with getSource
.
map.addLayer({ | ||
"id": "highlight", | ||
"type": "fill", | ||
"source": "boroughs", | ||
"source":{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: space before {
.
map.addLayer({ | ||
"id": "point", | ||
"type": "circle", | ||
"source": "point", | ||
"source":{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
thanks for the quick review @jfirebaugh . changes are in. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you do another pass for examples that use getSource
and revert them? I see at least one.
Then 🚢 on 🍏 .
Updating gl-js examples to reflect #3861. Mostly involves replacing
map.addSource()
, with declaring the source explicitly withinaddLayer()
. However, we're currently holding off on changing sources to which multiple layers refer.cc/ @lucaswoj @jfirebaugh