DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
  1. DZone
  2. Coding
  3. Languages
  4. HTML5 Geolocation: When, Why, How

HTML5 Geolocation: When, Why, How

John Esposito user avatar by
John Esposito
·
Feb. 01, 12 · Interview
Like (0)
Save
Tweet
Share
5.33K Views

Join the DZone community and get the full member experience.

Join For Free

As the web moves from interactivity to physical integration, mobile web use explodes all over the world, and the line between virtual and 'real' grows thin -- knowing your user's physical location becomes increasingly important. Location matters to physical people; therefore it will soon matter to web app users as well.

So geographic location will soon leave the land of specialized apps (like Foursquare) and become essential to web apps in general. This, of course, is why the W3C decided to write a specification for geolocation.

But when should you use geolocation? 

Danwel Tran Luciana explains in new developer's guide, offering a slew of use-cases including:

  • Public transit sites (for nearby stops/stations)
  • Shopping sites (for nearby stores/stock)
  • Online games (for linking game assignments to the physical world)

Danwel also explains some of the API details (functions; the position object; different kinds of location data).

But for a more thorough, code-centric take on the How of geolocation, try Ian Devlin's article on html5doctor (which includes, for example, fuller explanations of the getCurrentPosition and watchPosition functions).

Turns out the technical aspect of the API is very straightforward; so the more interesting problem is the When. Danwel's use-cases all makesense, but they don't break any new ground -- except maybe the reality-bending online gaming.

Foursquare was a killer location-specific app -- unsurprisingly, because it was social, another dimension along which the real-virtual distinction is blurring. I had a few ideas for geolocation use-cases, and would appreciate your feedback:

  • Historical travel guides with augmented reality: the app would display models (or wireframes, or blueprints, or whatever) that once stood where the user is currently located, drawing on GPS via the geolocation API and also device accelerometers via other (presumably also HTML5) APIs.
  • Architectural surveying tools: the app would match geolocation-derived coordinates with weather and other environmental data, and combine this with data from the mobile device's camera to suggest ideal building locations, materials, etc.
  • Flavor-localizing the UI: the app would pair the user's location with local aesthetic data (colors, materials, architectural features, population density, etc.) and adjust the UI to match. (I don't fully appreciate this one, but the idea comes from an artist friend of mine -- who absorbs every local aesthetic quite holistically, and is 'emotionally disequilibrated' by her device UI when it doesn't match.)

Of course, these apps would also need integration with good cloud APIs, both location-oriented and not location-oriented (on materials, for instance). But geolocation would figure essentially into all of these -- and with the HTML5 API gaining ground, and new cloud APIs popping up every week, perhaps in the very near future.

HTML mobile app

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Create a CLI Chatbot With the ChatGPT API and Node.js
  • Use AWS Controllers for Kubernetes To Deploy a Serverless Data Processing Solution With SQS, Lambda, and DynamoDB
  • OpenVPN With Radius and Multi-Factor Authentication
  • [DZone Survey] Share Your Expertise and Take our 2023 Web, Mobile, and Low-Code Apps Survey

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: