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

(not ready) Update examples for inline sources #3901

Merged
merged 12 commits into from
Jan 6, 2017
Merged

Conversation

peterqliu
Copy link
Contributor

Updating gl-js examples to reflect #3861. Mostly involves replacing map.addSource(), with declaring the source explicitly within addLayer(). However, we're currently holding off on changing sources to which multiple layers refer.

cc/ @lucaswoj @jfirebaugh

@@ -21,15 +21,15 @@

// Add a new source from our GeoJSON data and set the
// 'cluster' option to true.
map.addSource("earthquakes", {
var earthquakes = {
Copy link
Contributor

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 = {
Copy link
Contributor

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 = {
Copy link
Contributor

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 });
Copy link
Contributor

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", {
Copy link
Contributor

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', {
Copy link
Contributor

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":{
Copy link
Contributor

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":{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

@peterqliu
Copy link
Contributor Author

thanks for the quick review @jfirebaugh . changes are in.

Copy link
Contributor

@jfirebaugh jfirebaugh left a 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 🍏 .

@peterqliu peterqliu merged commit bd4547c into mb-pages Jan 6, 2017
@peterqliu peterqliu deleted the update-examples branch January 6, 2017 20:12
@lucaswoj lucaswoj mentioned this pull request Jan 27, 2017
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants