loading

Logout succeed

Logout succeed. See you again!

ebook img

Mapbox Cookbook PDF

pages264 Pages
release year2016
file size9.124 MB
languageEnglish

Preview Mapbox Cookbook

[ 1 ] Mapbox Cookbook Over 35 recipes to design and implement uniquely styled maps using the Mapbox platform Bill Kastanakis BIRMINGHAM - MUMBAI 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 made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: March 2016 Production reference: 1150316 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78439-735-7 www.packtpub.com Credits Author Project Coordinator Bill Kastanakis Nidhi Joshi Reviewer Proofreader Balkan Uraz Safis Editing Commissioning Editor Indexer Usha Iyer Mariammal Chettiyar Acquisition Editors Production Coordinator Vinay Argekar Conidon Miranda Shaon Basu Cover Work Content Development Editor Conidon Miranda Siddhesh Salvi Technical Editors Siddhesh Ghadi Taabish Khan Copy Editors Shruti Iyer Sonia Mathur About the Author Bill Kastanakis has been a software engineer for over 15 years with experience in desktop, mobile, and web application development. His love for the Mapbox platform came from a project he worked on in 2010 to build a series of iOS tourist guide apps. With maps being simplistic in appearance and their customization options being nearly zero, he discovered the potential of a platform that allows the developer to totally customize the appearance of maps and the experience of using them. Bill currently owns MindBomb, which specializes in mobile apps for the iOS platform, and he is a cofounder of nCoded+ Limited, which builds enterprise mobile and web applications for casino accounting. He also works as an iOS team lead and architect for one of the most popular apps in Ireland. Bill often contributes to presentations as well as writing several mobile development blogs about new mobile technologies. About the Reviewer Balkan Uraz is a city planner with a master's degree in Geographical Sciences. He has over 18 years of experience in the field of Geographic Information Systems. Throughout his career, Balkan has worked on several projects with one thing in common: GIS. In the early days of his career, he worked on projects involving municipal GIS and city information systems. He has worked on major LBS projects for mobile operators in Turkey that involve both software development and building data inventories. He cofounded a tech company that specializes in navigation data collection and products. He has also been a GIS consultant for major companies operating in the areas of field tracking and real estate. In all his projects, he has worked around his one passion, which is building up spatial infrastructure. Balkan is the coauthor of the book Google Maps JavaScript API Cookbook with Alper Dincer, published by Packt Publishing. www.PacktPub.com eBooks, discount offers, and more Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. TM https://www2.packtpub.com/books/subscription/packtlib Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books. Why Subscribe? f Fully searchable across every book published by Packt f Copy and paste, print, and bookmark content f On demand and accessible via a web browser Table of Contents Preface iii Chapter 1: Introduction to Mapbox 1 Introduction 1 Creating your own map 9 Adding vector data 12 Publishing your map 18 Chapter 2: Mapbox Services 23 Introduction 23 Accessing styled tiles on your map 26 Creating static images 31 Finding coordinates for an address 33 Finding an address from coordinates 36 Finding an address on a map click 38 Getting directions 40 Chapter 3: TileMill and Mapbox Studio 45 Introduction 45 Styling a map with TileMill 62 Styling a map with Mapbox Studio 85 Publishing your base map on your server with PHP 98 Publishing your base map on your server with Node.js 103 Chapter 4: Mapbox.js 105 Introduction 105 Creating a simple map 106 Changing map properties programmatically 109 Working with base layers 114 Adding markers and popups 118 Clustering markers to improve our map 123 i Table of Contents Getting mouse coordinates 129 Working with controls 133 Adding interactivity to your map with UTFGrid 137 Creating a choropleth map 144 Creating a heat map 151 Chapter 5: Mapbox.js Advanced 155 Introduction 155 Adding external data to your map 156 Adding a time dimension to your map 160 Comparing two maps at the same time 168 Adding a WMS layer from GeoServer to your map 171 Adding ArcGIS layers from a server or from online 179 Adding Fusion Tables to your map 186 Adding Foursquare data to your map 196 Chapter 6: Mapbox GL 203 Introduction 203 Integrating your project with Mapbox GL 204 Creating a basic map using Mapbox GL 208 Switching between locations programmatically 214 Adding markers to the map 218 Switching map styles 223 Loading GeoJSON and drawing a polyline 232 Drawing polygons on the map 237 Index 245 ii Preface Maps are an essential element in today's location-aware applications, but they lack variation and customization. The Mapbox platform offers the tools and APIs required to totally customize, populate, and publish a map. In this book, starting with the basics of Mapbox Editor for your first map styling steps, we will take you all the way to building advanced web and mobile applications with completely customizable map styles. The book focuses on the CartoCSS styling language as well as Mapbox tools and its JavaScript API, which inherits from Leaflet and is one of the most established, robust, and easy-to-use libraries. We will then introduce two core Mapbox tools: TileMill and Mapbox Studio. Using them, we will generate custom-styled map tiles and vector maps. We will then move on to how to publish your custom maps using PHP, Node.js, and third-party tools such as GeoServer. The next step is to start using the Mapbox JavaScript API and Leaflet to create different visualization map styles, such as a choropleth map and a heat map, and add user interactivity using UTFGrid. We will continue with the advanced chapters and focus on integrating with third-party services such as Foursquare, Google Fusion Tables, CartoDB, and Torque to help us populate and even animate our maps. Finally, we will end the book with a chapter dedicated to mobile devices. You will learn about Mapbox GL and how to create a fully functional, location-aware mobile app, which will use the map styles created in the earlier recipes. This book is fast-paced, and the recipes are easy to follow. While it focuses on a recipe approach, it dives into the core concepts and theory of the technologies used to help you understand the theory required for GIS, web, and mobile development. iii

See more

The list of books you might like