w3c / geofencing-api

13 stars 9 forks source link

Precision of circular regions #12

Closed chaals closed 8 years ago

chaals commented 9 years ago

What happens if I define a region as lat: 60 long: 12 radius: 6 - is the initially bigger ellipse reduced to a 12m size, or the radius ignored?

allanjuma commented 9 years ago

Is there a browser where this is implemented? can be tested?

mkruisselbrink commented 9 years ago

@chaals I'm not sure I entirely understand your question. Latitude and longitude determine a particular point on earth, and radius determines the size of a circle around that point. What is this "initially bigger ellipse"? But more specifically about precision, I'd like to leave user agents to ability to decide what actual precision they support. Specifically the region returned by registration.geofencing.add() is not guaranteed to be exactly the same region as what is passed to add. Implementation are free to round/move/adjust the region to what the implementation is willing to support.

@allanjuma this isn't currently implemented anywhere yet, unfortunately

chaals commented 8 years ago

The question was whether the spec defines what to do when the lat/long position described covers an area bigger than the radius given. The example of 60N12E covers an area on the order of 100km wide - 3N12E is even bigger.

It seems more rational when given something like that, plus a radius of say 10m, to make the radious bigger to match the precision of the coordinate than to ask implementations to just pretend they were given 60.0000000, 12.0000000 6 … although I have a nasty suspicion that implementations will start out doing the latter.

(Actually latitude and longitude describe something kind of egg-shaped, since the further away from the equator you are, the closer longitude lines get to each other. So rounding for any given precision, the polar end is skinnier. It only matters if you really care about where your fence actually is…)

mkruisselbrink commented 8 years ago

Ah, I think I see where the confusion is. It isn't really possible in javascript to distinguish between 60, 60.0, 60.00000 etc. So the latitude and longitude specified are assumed to be always indeed be 60.0000000 or whatever arbitrary precision makes sense. You're not asking for a geofence that includes everything at a certain latitude and longitude, the API allows you to ask for a geofence that includes a circle centered around the (assumed to be very precise) latitude and longitude. So the distance between longitude lines really doesn't matter.