Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Developing Mobile Web ArcGIS Applications
  • Table Of Contents Toc
Developing Mobile Web ArcGIS Applications

Developing Mobile Web ArcGIS Applications

By : Sheehan
4 (7)
close
close
Developing Mobile Web ArcGIS Applications

Developing Mobile Web ArcGIS Applications

4 (7)
By: Sheehan

Overview of this book

This guide is invaluable to those just starting out with GIS development but will also benefit GIS professionals wishing to expand their development skills to include mobile apps.
Table of Contents (9 chapters)
close
close
8
Index

JavaScript Geolocation API

It's time to add a very mobile-specific element to our code—geolocation or "zoom to my current location" functionality. We discussed the Geolocation API in Chapter 2, Understanding Mobile Frameworks and APIs. Let's now put it to use. First, we will need to set an event listener, in this case, a map load listener:

map.on("load", myLoadHandler);

Inside the myLoadHandler function we will reference the Geolocation API. We will detect whether or not the navigator.geolocation object is available. This is a best practice because not all browsers support geolocation-based navigation. The position object will return coords.latitude, coords.longitude, and coords.accuracy. It might also return coords.altitude, coords.altitudeAccuracy, coords.heading, coords.speed, and timestamp. Note that this varies by browser. We also need to handle any errors if the object is not available with the locationError() function. The following code snippet...

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Developing Mobile Web ArcGIS Applications
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon