Mapbox Cookbook
eBook - ePub

Mapbox Cookbook

  1. 264 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Mapbox Cookbook

About this book

Over 35 recipes to design and implement uniquely styled maps using the Mapbox platform

About This Book

  • Design and develop beautifully styled maps using TileMill, MapBox Studio, and CartoCSS
  • Get to grips with the mapbox.js and Leaflet to create visually stunning web and mobile applications
  • An easy-to-follow, quick reference guide to integrate powerful APIs and services like Foursquare, Fusion Tables, Geoserver, and CartoDB to populate your maps

Who This Book Is For

If you are a web developer seeking for GIS expertise on how to create, style, and publish interactive and unique styled maps, then this book is for you. Basic knowledge of programming and javascripts is assumed.

What You Will Learn

  • Get accustomed to the MapBox Editor to visually style your maps
  • Learn everything about CartoCSS, and how it will help you fine tune your styled maps
  • Use MapBox Studio and Tilemill to generate your own tiles and vector maps
  • Publish your maps using a variety of technologies like node.js, PHP, and Geoserver
  • Integrate with third party APIs and services to populate your maps with public or private data
  • Create many different map visualization styles like choropleth and heat maps, add interactivity, and even learn how to animate data over time
  • Work with many different data formats and external services to create robust maps
  • Learn to use MapBox GL to create a mobile application

In Detail

Maps are an essential element in today's location aware applications. Right from displaying earth surface information to creating thematic maps displaying plethora of information, most of the developers lack the necessary knowledge to create customizable maps with combination of various tools and libraries. The MapBox platform is one such platform which offers all the tools and API required to create and publish a totally customizable map.

Starting with building your first map with the online MapBox Editor, we will take you all the way to building advanced web and mobile applications with totally customizable map styles. Through the course of chapters we'll learn CartoCSS styling language and understand the various components of MapBox platform and their corresponding JavaScript API.

In the initial few chapters we will dive deeper into the TileMill and MapBox Studio components of MapBox and use them to generate custom styled map tiles and vector maps. Furthermore, we will publish these custom maps using PHP, node.js and third party tools like Geoserver.

We'll also learn to create different visualizations and map styles like a choropleth map, a heat map and add user interactivity using a UFTGrid. Moving on, we dive into advanced concepts and focus on integration with third party services like Foursquare, Google FusionTables, CartoDB, and Torque to help you populate and even animate your maps.

In the final chapter we'll learn to use the Mapbox SDK to create and publish interactive maps for the iOS platform. By the end of this book, you will learn about MapBox GL and how to create a fully functional, location-aware mobile app, using the maps styles created in the recipes.

Style and approach

An easy-to-use recipe driven book that will not just serve code samples, but also explains all the theory and concepts required to fully understand each recipe.

Tools to learn more effectively

Saving Books

Saving Books

Keyword Search

Keyword Search

Annotating Text

Annotating Text

Listen to it instead

Listen to it instead

Information

Mapbox Cookbook


Table of Contents

Mapbox Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
eBooks, discount offers, and more
Why Subscribe?
Preface
What this book covers
What you need for this book
Who this book is for
Sections
Getting ready
How to do it…
How it works…
There's more…
See also
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Introduction to Mapbox
Introduction
Getting started with Mapbox
Data
Mapbox Editor
CartoCSS
TileMill
Mapbox Studio
API and SDK
Creating your own map
Getting ready
How to do it…
How it works…
Adding vector data
Getting ready
How to do it…
Creating a marker
Creating lines
Creating polygons
Modifying and deleting data
There's more…
Importing data
Editing imported data
Publishing your map
Getting ready
How to do it…
There's more…
Embedding a map in a self-hosted page
2. Mapbox Services
Introduction
Access tokens
Finding the Map ID
Accessing styled tiles on your map
How to do it…
How it works…
There's more…
Fetching a single tile
Creating static images
How to do it…
Creating the static map
Adding a marker
Finding coordinates for an address
How to do it…
How it works…
Query parameters
Returned results
Finding an address from coordinates
How to do it…
Finding an address on a map click
How to do it…
How it works…
Getting directions
How to do it…
How it works…
3. TileMill and Mapbox Studio
Introduction
Understanding TileMill
Understanding Mapbox Studio
Introducing CartoCSS
How CartoCSS works
Filters
Comparisons
Working with colors
Styling lines
Styling polygons
Styling labels
Attachments
Styling a map with TileMill
How it works…
How to do it…
Downloading the map data
Inspecting the downloaded files using QGIS
Importing downloaded data into TileMill
Styling data using CartoCSS
Styling a map with Mapbox Studio
How it works…
How to do it…
Styling a map
There's more…
Publishing your base map on your server with PHP
How it works…
How to do it…
Exporting a map from TileMill
Converting an MBTiles database into regular PNG files
Creating a tile server PHP project
Publishing your base map on your server with Node.js
Getting ready
How to do it…
Creating a tile server Node.js project
4. Mapbox.js
Introduction
Creating a simple map
How to do it…
How it works…
Changing map properties programmatically
How to do it…
Panning the map programmatically
Zooming the map programmatically
Zooming to a map region programmatically
How it works…
Working with base layers
How to do it…
Switching between layers
Adding markers and popups
How to do it…
Adding a basic marker with a popup
Creating markers using the geocoder
How it works…
Clustering markers to improve our map
How to do it…
Creating markers
Creating a simple polyline and polygon
Getting mouse coordinates
How to do it…
How it works…
Working with controls
How to do it…
Adding a zoom control to the map
How it works…
Adding interactivity to your map with UTFGrid
How to do it…
Creating an interactive map using TileMill
Creating an interactive map using Mapbox.js
How it works…
Creating a choropleth map
How to do it…
How it works…
Creating a heat map
How to do it…
How it works…
5. Mapbox.js Advanced
Introduction
Adding external data to your map
How to do it…
Loading external data
Loading a GPX file
How it works…
Adding a time dimension to your map
How to do it…
Importing the data to CartoDB
Using torque to visualize data over time
Comparing two maps at the same time
How to do it…
Comparing two maps
Adding a WMS layer from GeoServer to your map
How to do it…
Adding WMS images from GeoServer to your map
Installing GeoServer
Creating a layer
Displaying WMS layers using Mapbox.js
Adding ArcGIS layers from a server or from online
How to do it…
Adding ArcGIS layers from the server or from online
Adding Fusion Tables to your map
How to do it…
Acquiring a Fusion Tables API key
Creating a Fusion Table
Adding Fusion Tables data to your map
Adding Foursquare data to your map
How to do it…
Getting Foursquare data to your map
6. Mapbox GL
Introduction
Integrating your project with Mapbox GL
How to do it…
Creating the Xcode project file and linking it to Mapbox GL
Creating a basic map using Mapbox GL
How to do it…
How it works…
Switching between locations programmatically
How to do it…
How it works…
Adding markers to the map
How to do it…
How it works…
There's more…
Switching map styles
How to do it…
There's more…
One more thing…
How it works…
Loading GeoJSON and drawing a polyline
How to do it…
How it works…
Drawing polygons on the map
How to do it…
How it works…
Index

Mapbox Cookbook

Copyright Ā© 2016 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been ma...

Table of contents

  1. Mapbox Cookbook

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access Mapbox Cookbook by Bill Kastanakis in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming. We have over one million books available in our catalogue for you to explore.