Fireship · @fireship
Realtime Maps with Mapbox + Firebase + Angular
Uploaded July 28, 2017 · Length 6:48
Summary
build real-time maps with mapbox, angular, and Firebase by creating a map that updates in real-time with user input and GPS coordinates
- mapbox api
- angular 4
- firebase database
- real-time maps
- gps coordinates
- geojson spec
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
realtime map features are part of some
- 0:02
of the most successful apps in the world
- 0:04
such as Uber ways and Pokémon go in this
- 0:07
episode I'm going to show you how to
- 0:09
start building your own real-time map
- 0:10
features using the mapbox API with
- 0:13
angular 4 on the front end and Firebase
- 0:15
on the back end the demo you're looking
- 0:17
at here allows users to post messages on
- 0:19
the map that are associated with
- 0:21
specific GPS coordinates then the user
- 0:24
can click on the message and fly to
- 0:25
wherever those GPS coordinates happen to
- 0:27
be the important thing to notice here is
- 0:30
that the data in Firebase and the map
- 0:32
are staying in sync in real time so any
- 0:34
user observing this map will have access
- 0:36
to the latest data as soon as it's saved
- 0:38
to the Firebase database before we get
- 0:40
into the code I want to share a helpful
- 0:42
tutorial from West Doyle he spends a
- 0:44
full hour building a RunKeeper inspired
- 0:46
angular 4 app which is a great resource
- 0:49
if you're working with mapbox you can
- 0:50
find the link in the description below
- 0:53
the first step is to sign up for a free
- 0:55
mapbox account and then retrieve your
- 0:57
API access token during the initial
- 1:00
setup mapbox should give you a link to
- 1:02
the CSS that you can include in the
- 1:04
index.html file and then you'll want to
- 1:08
add your access token to your
- 1:10
environment file then you can run npm
- 1:12
install mapbox DGL mapbox has some good
- 1:16
default Maps out of the box but you can
- 1:17
customize them to an infinite number of
- 1:20
combinations in this case I'm using the
- 1:22
cogram app to mimic the color pattern in
- 1:24
an image then you can use the mapbox
- 1:27
editor to customize all the finer
- 1:29
details Within in the map one thing
- 1:30
that's really important when working
- 1:32
with any geolocation data is to make
- 1:34
sure it follows a consistent format in
- 1:36
this example we're going to create a
- 1:37
typescript interface to ensure that it
- 1:40
follows the geojson spec geolocation
- 1:43
data is often shared between multiple
- 1:45
platforms so we want to make sure our
- 1:47
app is following the same spec that
- 1:48
every other API is going to follow the
- 1:51
most important aspect here is the
- 1:52
geometry which is just the GPS
- 1:54
coordinates of a given location we're
- 1:57
also going to create a feature
- 1:58
collection class which is is part of the


