-
Notifications
You must be signed in to change notification settings - Fork 74
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
Add tutorials #774
Add tutorials #774
Conversation
398e8b7
to
9f1ebc9
Compare
tutorials/vector_point/index.pug
Outdated
block mainTutorial | ||
:markdown-it | ||
# Tutorial - Vector point | ||
First, let's create our map and add a base map. Also, to make simple, we import our data inline. |
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 would change to make simple
to to keep it simple
.
tutorials/vector_point/index.pug
Outdated
:markdown-it | ||
Then create point feature and set the data. | ||
|
||
+codeblock('javascript', 3). |
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 recommend making the default step that runs be this one, since it shows points on the map (and therefore will be better for the thumbnail showing off the tutorial).
tutorials/vector_point/index.pug
Outdated
|
||
block mainTutorial | ||
:markdown-it | ||
# Tutorial - Vector 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.
This tutorial is called Vector Point
, but it is just showing points (not vectors), so I think it should be renamed.
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.
Oh, yes that's right. (I was thinking this is not WMS layer, but now I see you mean a point is not a vector). So, do you think the name Geography 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.
I think Geospatial Point
or Geographic 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.
Or just simple point. I'make it simple point for now.
tutorials/vector_point/index.pug
Outdated
var feature = layer.createFeature('point') | ||
.data(cities.features) | ||
.position(function (city) { | ||
return { x: city['geometry']['coordinates'][0], y: city['geometry']['coordinates'][1] }; |
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'd recommend, in general, using shorter lines in the tutorial so that there is less chance the user has to scroll to see the whole line. So this return could be rewritten as
return {
x: city['geometry']['coordinates'][0],
y: city['geometry']['coordinates'][1]
};
tutorials/contour/index.pug
Outdated
|
||
:markdown-it | ||
Then load some data. | ||
The data is grid data describing geospatial point elevation, a record of z value -9999 means it's sea level. |
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.
Pedantically, the value of -9999 means that there is no land data (rather than that it is sea level).
f136998
to
ce3f9e6
Compare
tutorials/contour/index.pug
Outdated
})); | ||
|
||
:markdown-it | ||
Once the data is loaded. We create the contour feature with default color range. *min: 0* means only showing data with elevation. |
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.
You can surround examples that are in the code with backticks (rather than using an asterisk to italicize it). With the change the background color for the tutorials, we may want to add code: { background: <some contrasting color>; }
to the tutorial css.
ce3f9e6
to
6f37753
Compare
colorRange: ['rgb(224,130,20)', 'rgb(253,184,99)', 'rgb(254,224,182)', 'rgb(216,218,235)', 'rgb(178,171,210)', 'rgb(128,115,172)', 'rgb(84,39,136)'] | ||
}) | ||
.draw(); | ||
}); |
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 also show using stepped: false
?
6f37753
to
d7c1306
Compare
Eventually, I'd like to see some of the tests added to these (it can wait for a future PR). For the contour test, this will probably require PR #775 to be merged to pass on Chrome headless. |
d7c1306
to
d3b230e
Compare
tutorials/vector_point/index.pug
Outdated
:markdown-it | ||
We can also use GeoJSON reader to create the point feature. | ||
|
||
+codeblock('javascript', 10, 3, false, 'Step 3-B'). |
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 think you want the parent step to be step 2.
If we wanted to make the point (and the choropleth) tutorial simpler, we could have the data be in a simpler form that GeoJSON (possibly we GeoJSON as an alternative). For instance, step 1 could define
Then step 3 becomes just:
And step 3-B would redefine |
tutorials/choropleth/index.pug
Outdated
Now we style polygon with color. | ||
|
||
+codeblock('javascript', 3, 2, false). | ||
var polulations = (states.features.map(function (state) { return state.properties.population })); |
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.
polulations
-> populations
I was thinking GeoJSON is mentally simple to accept. I kinda don't want to depend on default behavior too much because it might give the user an impression that the input data has to be formatted in a certain way, and you can only use geojson with the json reader. |
I agree that I don't want people thinking we only accept one format, which is why I think we need to show it is something besides (and simpler than) GeoJSON. We also want to show that it is easy to handle GeoJSON, since it is the common format. Instead of using Or, we ultimately (not now) want another tutorial showing the flexibility of formats using various positions and styles. |
button.codeblock_run Run | ||
button.codeblock_reset Reset | ||
button.codeblock_run.btn.btn-primary.btn-sm Run | ||
button.codeblock_reset.btn.btn-link.btn-sm Reset |
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.
We should add these classes to the tutorials/common/index.pug
file as well, since I generate thumbnails from that and it will then look the same).
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.
Oh, when you generate, is it the exact same page as local tutorials? If so, I think I'll need to update the overwritten bootstrap styles to match the website first.
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 use xvfb and Chrome with the local tutorials to generate the thumbnails (that way it doesn't have the framing elements as part of the tutorial). To my eye, the button style change is the only significant difference, so it would be sufficient.
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 should say, I don't think the font difference is that significant for the thumbnails.
tutorials/choropleth/tutorial.json
Outdated
"tutorialCss": [], | ||
"tutorialJs": [], | ||
"about": { | ||
"text": "Create a choropleth map" |
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 is the text shown when hovering over a tutorial, so I'd like it to be a bit more verbose. Perhaps Create a choropleth map, set the colors used, and add a legend.
tutorials/contour/index.pug
Outdated
|
||
block mainTutorial | ||
:markdown-it | ||
# Tutorial - Contour map |
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.
It looks like I've mostly capitalized things in other tutorial titles, so can this be Contour Map
. Also change in the tutorial.json file and do similarly for the Simple Point tutorial as well.
tutorials/contour/tutorial.json
Outdated
"tutorialCss": [], | ||
"tutorialJs": [], | ||
"about": { | ||
"text": "Add a contour map" |
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.
A better description might be: Plot grid data as a color contour.
e918ad7
to
66062b7
Compare
tutorials/simple_point/index.pug
Outdated
.position(function (city) { | ||
return { | ||
x: city['geometry']['coordinates'][0], | ||
y: city['geometry']['coordinates'][1] | ||
x: city['lon'], |
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.
city.lon
and city.lat
would work, too.
Elsewhere in the css for the local version we expect the navbar to have a height of 60px. Removing flatly breaks that assumption, which would require changing several more things. For now, I would revert this removal. I don't include the navbar as part of the thumbnails, so that won't be affected. |
2c332c0
to
1314a8a
Compare
…tion; Rename one tutorial;
e3c8ea6
to
e136552
Compare
Add a few tutorials and apply some style updates.
This is a WIP, but feel free to comment.
The style change on the website:
