Opened 12 years ago

Closed 6 years ago

#11463 closed enhancement (patchwelcome)

Add dojox.geo.location API

Reported by: dylan Owned by: dylan
Priority: high Milestone: 1.13
Component: Dojox Version: 1.5
Keywords: Cc:
Blocked By: Blocking:


Create a geolocation wrapper for browsers that support geo, with handlers if user allows location to be shared. Fallback mechanism is a request to third-party API, e.g. Google geolocation API.

Attachments (2)

Location.js (1.4 KB) - added by dylan 11 years ago.
stub for dojox.geo.Location
test_Geolocation.html (884 bytes) - added by dylan 11 years ago.
Stub test file for dojo.geo.Location

Download all attachments as: .zip

Change History (15)

comment:1 Changed 11 years ago by Jose Moreira

+1 for this feature. Any news? I'm interested in this and i can give a go at it.

Changed 11 years ago by dylan

Attachment: Location.js added

stub for dojox.geo.Location

Changed 11 years ago by dylan

Attachment: test_Geolocation.html added

Stub test file for dojo.geo.Location

comment:2 Changed 11 years ago by dylan

Status: newassigned

I've done some preliminary work as you can see in the two attached files, so yes, I could use some help making this actually work.

There's also an implementation by a summer of code student that targets mobile features, but I haven't investigated that work yet.

comment:3 Changed 11 years ago by dylan

comment:4 Changed 11 years ago by Jose Moreira

Will look at it asap. Got interested in this feature because i'd like to develop a simple prototype for a "local area/radius chat room". Started reading the w3c spec and will try to get a glimpse of the browser support feature matrix. I have an iPhone and i can also run tests there and also on the Android SDK emulators. Will report as soon as i have news.

comment:5 Changed 11 years ago by Jose Moreira

Have some code in . currently just some data types to represent a coordinate (lat/long) and a position (lat+long and possibly many others in the future as speed and bearing).

I've also too a look at the Google SoC project.

I'm considering implementing the geo api as one "*PositionLocator?" class per service, i.e. HTML5PositionLocator and GooglePositionLocator? and a "main wrapper", something like Location. I'm using this code as a guide for utility methods.

Stop me before i do anything foolish ;)

comment:6 Changed 11 years ago by dylan

I'm generally ok with the approach, and I like that it basically follows the same approach as local storage.

I would like to see a short name to get the current values, e.g. something like dojo.geo.location.get() , but there's a reason I'm not allowed to do API design.

The distance return seems useful, though I'd like to see the names be something like getDistance(position, unit) which would allow us to also support miles.

And perhaps we want to move the conversion, as well as the distance calculations to a new module, something like dojox.math.convert or dojox.convert ?

comment:7 Changed 11 years ago by Jose Moreira

Back. ok i'll goon with the implementation and i'll refactor as required along the way to meet the dojo standards.

I could port Chris Veness's math code,, to maybe dojox.math.trigonometry .

Yes, miles vs km and so on, that makes me thing about doing something related to the locale (having defaults based on the user's dojo.locale,? )

I can move that code to dojox.math and use that package from dojox.geo, so it's more reusable.

As for the "local storage" approach, i thought it made sense because of the mixed support where geo location is at currently and even with the advent of JS engines like rhino and node.js, there is a place for dojo even out of the browser, so eventually, dojo could even interact with GPS hardware in the future. I believe querying capabilities like that is more practical than having lots of "isXSupported()" methods.

Hopefully i'll punch more code this week.

comment:9 Changed 11 years ago by dylan

Milestone: 1.61.7

comment:10 Changed 11 years ago by dylan

Milestone: 1.71.8

comment:11 Changed 10 years ago by dylan

Milestone: 1.82.0

We've missed the boat for new features in 1.8, pushing to 2.0.

comment:12 Changed 9 years ago by Sherbrooke Andrews

As I have needed to use something simmilar, I have updated the geo code to be compatible with 1.8, as well as making the distance to function work, and updating the provider.getCurrentPosition to return a deferred as oposed to taking a callback and errorback function as paramaters, if you want to use this moving forward please feal free to, the source can be found here -

hope that helps!

comment:13 Changed 6 years ago by dylan

Milestone: 2.01.12
Resolution: patchwelcome
Status: assignedclosed

Will revisit as an extension for Dojo 2 if there's interest. Closing as patchwelcome for now.

Note: See TracTickets for help on using tickets.