Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for accuracy #4

Open
LinusU opened this issue Feb 20, 2015 · 2 comments
Open

Support for accuracy #4

LinusU opened this issue Feb 20, 2015 · 2 comments

Comments

@LinusU
Copy link

LinusU commented Feb 20, 2015

I think that it would be very useful to be able to specify the accuracy at which the coordinates where obtained. E.g.

{
  "type": "Point",
  "coordinates": [ 18.076479, 59.334537, 14.507372 ],
  "accuracy": [ 65, 65, 10 ]
}

We would need to decide on which unit to specify the accuracy in. In my example I used meters since that is what the HTML5 Geo API returns, but I'm not sure that it's the best way. Maybe GDOP could be the way to go...

@LinusU
Copy link
Author

LinusU commented Feb 20, 2015

I might add that the 65 in this case specifies that the position is somewhere in a circle with a radius of 65 meters and the center at the specified longitude and latitude. My first thought was to specify three accuracy value for the longitude, latitude and altitude respectively, but this might have been a bad idea.

A better proposal would probably be to specify it as [ 65, 10 ] with the second value being optional.

Some new examples:

{
  "type": "Point",
  "coordinates": [ 18.076479, 59.334537, 14.507372 ],
  "accuracy": [ 65, 10 ]
}
{
  "type": "Point",
  "coordinates": [ 18.076479, 59.334537, 14.507372 ],
  "accuracy": [ 65 ]
}
{
  "type": "Point",
  "coordinates": [ 18.076479, 59.334537 ],
  "accuracy": [ 65 ]
}

@LinusU
Copy link
Author

LinusU commented Feb 20, 2015

Sample implementations:

Javascript

function currentLocation(cb) {
  function error(err) { cb(err); }
  function success(geo) {
    cb(null, {
      type: 'Point',
      coordinates: [ geo.coords.longitude, geo.coords.latitude, geo.coords.altitude ],
      accuracy: [ geo.coords.accuracy, geo.coords.altitudeAccuracy ]
    });
  }

  navigator.geolocation.getCurrentPosition(success, error);
}

Swift

extension CLLocation {
    func toGeoJSONDict() -> [String: AnyObject] {
        return [
            "type": "Point",
            "coordinates": [ coordinate.longitude, coordinate.latitude, altitude ],
            "accuracy": [ horizontalAccuracy, verticalAccuracy ]
        ]
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant