Welcome to Methods 3, Lecture 9
This is a web page that can be viewed as slides.
→ to move forward
← to go back
Methods 3
#layer::labels[zoom > 14] {
text-name: [school];
text-face-name: 'DejaVu Sans Book';
text-size: 18;
text-fill: rgba(8, 8, 65, 0.51);
text-label-position-tolerance: 0;
text-halo-radius: 0;
text-halo-fill: #6f808d;
text-dy: 0;
text-allow-overlap: false;
text-placement: point;
text-placement-type: dummy;
text-opacity: 0;
}
...
#layer-name[square_footage < 50] {
marker-width: 8;
marker-fill: #fcb200;
}
#layer-name[square_footage >= 50] {
marker-width: [square_footage]*.01;
marker-fill: #cc66cb;
}
#layer-name[square_footage >= 6000] {
marker-fill: #66C5CC;
}
#layer-name[square_footage >= 15000] {
marker-width: [square_footage]*.0001;
}
#layer {
marker-fill: #ff307a;
marker-line-color: #FFF;
marker-line-width: 0.25;
marker-line-opacity: 0.4;
marker-width: 2;
marker-allow-overlap: true;
}
#layer {
marker-width: 3;
...
[zoom >= 10] {
marker-width: 8;
}
[zoom >= 16] {
marker-width: 15;
}
}
milestones are due November 8th
next week we'll set aside some time to talk about where you're at
more ways to get data
look for WFS (web feature service) URLs
source
you could also look for Esri FeatureServer URLs
try it out: search for a WFS or FeatureServer URL you could use
Getting data from OpenStreetMap
a free map of the world
source
kinda like a giant shapefile of the world
source
if you need a whole city
source
if you only need a certain feature type
not sure what to search for?
find something you would like to get data for
right-click on it
use the tags you find
collecting your own data
"We enlisted people to go to stops, measure traffic and count people getting off and on and we hired bike messengers to see where the buses went..."
source
"... The cyclists used Field Papers to transcribe the various routes and what they found out, which we recompiled back into a database of trips, stops, companies and frequency."
source
- download GeoTIFF
- open in QGIS
- create new shapefile and trace
want to collect data directly on a phone?
costs $$ but can likely get a student deal
source
basically QGIS on an android device
source
you can load a QGIS project and create/edit data in it
source
using SVG icons with Carto
customizing legends and popups
for example, to add data sources to legends
or to customize popup text and layout
like last time, we'll need a little code to do this
HTML
HTML gives content and structure to web pages
<p>
<a href="http://data.cityofnewyork.us">source</a>
</p>
<p>some text on a web page</p>
<p>
the paragraph opening tag
<p>
the paragraph opening tag
opening tags always start with
<
<p>
the paragraph opening tag
opening tags always start with
<
and end with
>
</p>
the paragraph closing tag
</p>
the paragraph closing tag
closing tags always start with
</
and end with
>
<p>some text on a web page</p>
<a href="http://data.cityofnewyork.us">source</a>
HTML in Carto
you can add HTML before and after Carto legends
in popups, {{}}
around a field name will be replaced by the value of that field for the feature you clicked
{{neighbourhood}}, {{neighbourhood_group}}
{{neighbourhood}}, {{neighbourhood_group}}
becomes
SoHo, Manhattan
you can use this to add links within Carto maps
<p>
<a href="http://data.cityofnewyork.us">source</a>
</p>
and in popups those links can change based on the clicked feature
<p>
<a href="{{url}}">learn more</a>
</p>
<p>
<a href="{{url}}">learn more</a>
</p>
(if there is a field called url
)
CSS
CSS
makes webpages look nice
CSS
deceptively similar to CartoCSS, but not CartoCSS
<p>
some text on a web page
</p>
<p style="font-size: 20px;">
some text on a web page
</p>
similar to CartoCSS but just for webpages
source
<div class="CDB-infowindow">
<div class="CDB-infowindow" style="color: green;">
add style="" in an opening tag
you can add images with HTML
<img src="http://i.ytimg.com/cat.jpg" />
if you want to learn a more about HTML and CSS, there are many free resources
if you take Advanced GIS we'll get into much more depth