Instant HTML5 Geolocation How-To
eBook - ePub

Instant HTML5 Geolocation How-To

Ben Werdmuller

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

Instant HTML5 Geolocation How-To

Ben Werdmuller

Book details
Book preview
Table of contents
Citations

About This Book

In Detail

We don't just surf the Web from our desktops any more - we take it with us, everywhere we go. Modern devices contain sophisticated hardware and software to determine the user's location. Apps such as Foursquare and Google Maps use this to create new kinds of functionality. Now, you can do this too with the HTML5 Geolocation API.

"Instant HTML5 Geolocation How-to" is a simple guide to adding location information to your web applications. The practical, easy-to-follow recipes are designed to help you learn the ins and outs of the API. You'll learn how to use it, how it works, and how to save and display geographic information on the web.

Beginning with a solid grounding in how the Geolocation API works and when to use it, you will learn how to determine, store, display, and track the user's location via a series of clear recipes.

You will learn the different ways location is determined on different devices, including desktops and laptops that don't have GPS units. You'll also learn how to selectively use these different behaviours, based on the speed, accuracy, and battery life requirements of your application. You'll also get some hints about using MySQL databases to store sets of location data.

"Instant HTML5 Geolocation How-to" will teach you everything you need to know about retrieving the location information your application needs, across multiple devices and platforms.

Approach

Filled with practical, step-by-step instructions and clear explanations for the most important and useful tasks. The book will take a how-to approach, focusing on recipes that demonstrate geolocation in HTML5.

Who this book is for

This book is for web developers who want to incorporate geolocation technology into their applications. Previous knowledge about geolocation software or standards is not required. However, this book assumes a general understanding of web technologies, and both Javascript and jQuery in particular.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
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 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
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 here.
Is Instant HTML5 Geolocation How-To an online PDF/ePUB?
Yes, you can access Instant HTML5 Geolocation How-To by Ben Werdmuller in PDF and/or ePUB format, as well as other popular books in Informatique & Programmation en HTML. We have over one million books available in our catalogue for you to explore.

Information

Year
2013
ISBN
9781782165903

Instant HTML5 Geolocation How-to


Instant HTML5 Geolocation How-to

Copyright © 2013 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: May 2013
Production Reference: 1160513
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78216-590-3
www.packtpub.com

Credits

Author
Ben Werdmuller
Reviewers
Mark DuBois
Matt West
Acquisition Editor
James Jones
Commissioning Editor
Sharvari Tawde
Technical Editor
Prasad Dalvi
Project Coordinator
Suraj Bist
Proofreader
Ting Baker
Cover Image
Shantanu Zagade
Production Coordinator
Aparna Bhagat
Cover Work
Aparna Bhagat

About the Author

Ben Werdmuller is a web developer, product manager, and entrepreneur. He co-founded Elgg, an open source social networking platform used by organizations such as NASA, the World Bank, and Oxfam. Currently, he serves as the CTO of latakoo.com, an enterprise platform for sending, storing, and sharing videos and large files. He writes at benwerd.com.

About the Reviewers

Mark DuBois has been working with HTML since 1992. He built his first commercial website in 1995. Mark created the first accredited AAS degree in Web Systems and the first accredited certificate in rich Internet application development. Mark teaches many courses in web technologies at Illinois Central College. He has developed over 20 semester-long classes on various aspects of web design, development, and application security. His focus is on industry best practices regarding such items as security, accessibility, and web standards in these courses. He also serves as Director of Education for WebProfessionals.org and is recognized by Adobe as an Adobe Education Leader. Mark has recently taught numerous classes on HTML5, CSS3, and development of mobile apps using PhoneGap. He helps run both the Illinois and national web design contests for WebProfessionals.org (under the auspices of SkillsUSA). He can be found on Twitter (@Mark_DuBois) and posts articles on various aspects of web technology at http://blog.markdubois.info and http://blog.learning-html5.info.
Matt West is a developer and entrepreneur from Northampton, England. He previously founded the web development agency Developer City and is a contributor to a number of open source projects. Matt is currently working at his latest company, Koji Labs, which aims to create technological solutions for some of the world's biggest problems.
Matt is also the author of HTML5 Foundations (Wiley, 2012) and writes a blog at codingskyscrapers.com. You can find him on twitter as @MattAntWest.

www.PacktPub.com

Support files, eBooks, discount offers and more

You might want to visit www.PacktPub.com for support files and downloads related to your book.
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 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.
Support files, eBooks, discount offers and more
http://PacktLib.PacktPub.com
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books.

Why Subscribe?

  • Fully searchable across every book published by Packt
  • Copy and paste, print and bookmark content
  • On demand and accessible via web browser

Free Access for Packt account holders

If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.

Preface

Welcome to Instant HTML5 Geolocation How-to. This guide will help you make any web application aware of a user's location, quickly and easily. You will learn how to map a user's geographic location, integrate with popular mapping platforms, and track the user over time. In the process, you will create a simple application that generates a KML file containing both a path and points that you choose to save along that path (which can then be imported into Google Maps).
The iPhone changed the way we use the web. It was the first mobile device that included web browsing as a primary function. Suddenly, with mobile data and a phone like the iPhone, the web could be in your pocket, wherever you went. Through HTML5 and APIs, web applications could be truly context sensitive; they could know where you were, if you wanted them to, and react accordingly.
The Geolocation API is not part of HTML5, and is, instead, a JavaScript API standard. However, it sits alongside the evolving HTML5 specification as an important part of any modern web development toolkit.

What this book covers

Understanding the Geolocation API (Simple) discusses how the JavaScript Geolocation API works, when you should use it, and how it is implemented in different browsers and on different devices.
Setting up the application (Simple) explains how to configure and set up a sample application layout suitable for running a simple Geolocation-aware web application. Each step is explained in a way that will help you understand how your data will be stored so that you can scale your application when you're ready.
Getting the user's location (Intermidiate) illustrates how to detect Geolocation support in the user's web browser, use the API to obtain the user's coordinates, and handle any errors that might occur.
Displaying the user's location using the Google Maps API (Intermidiate) discusses how to display the coordinates obtained in the previous section in a visual way using Google Maps.
Displaying the user's location using a KML feed (Intermidiate) explains how to create the KML feed from coordinates you have saved in previous sections, and test it by importing it into Google Maps. KML feeds are supported by popular mapping applications such as Google Maps and Google Earth, as well as specialist GIS software.
Tracking and updating the user's location (Intermidiate) illustrates how to track the user and show his/her path, using simple web technologies. Sometimes, tracking the user's movements is important. Here we will use watchPosition() and clearPosition() to track the user's location over time, and change the maps that were created in the previous section.

What you need for this book

You need to have access to a server or computer running Apache Web Server, MySQL, and PHP. You will also need a text editor, a recent version of a major web browser, and optionally, a web-capable mobile device with GPS...

Table of contents

Citation styles for Instant HTML5 Geolocation How-To

APA 6 Citation

Werdmuller, B. (2013). Instant HTML5 Geolocation How-To (1st ed.). Packt Publishing. Retrieved from https://www.perlego.com/book/390576/instant-html5-geolocation-howto-pdf (Original work published 2013)

Chicago Citation

Werdmuller, Ben. (2013) 2013. Instant HTML5 Geolocation How-To. 1st ed. Packt Publishing. https://www.perlego.com/book/390576/instant-html5-geolocation-howto-pdf.

Harvard Citation

Werdmuller, B. (2013) Instant HTML5 Geolocation How-To. 1st edn. Packt Publishing. Available at: https://www.perlego.com/book/390576/instant-html5-geolocation-howto-pdf (Accessed: 14 October 2022).

MLA 7 Citation

Werdmuller, Ben. Instant HTML5 Geolocation How-To. 1st ed. Packt Publishing, 2013. Web. 14 Oct. 2022.