publiclab / blurred-location

A JavaScript library to help manage variable location privacy through a "blurred location" model
GNU General Public License v3.0
4 stars 1 forks source link

Add convertor functions #4

Closed sagarpreet-chadha closed 5 years ago

sagarpreet-chadha commented 5 years ago

can we have a pair of converters like BL.distanceToPrecision(meters, latitude) and BL.precisionToDistance(decimals, latitude)? If no latitude is specified, we could output a message explaining how precision changes with latitude, and mentioning the latitudes of two cities with very different values?

Hi @jywarren , how to implement this ?

What does distance here refers to ? Thanks 😄 !

jywarren commented 5 years ago

So, it would accept a distance in meters, and output a precision (say, 0.01 or 0.001... however we want to represent precision values?)

On Thu, Mar 14, 2019 at 2:44 PM Sagarpreet Chadha notifications@github.com wrote:

can we have a pair of converters like BL.distanceToPrecision(meters, latitude) and BL.precisionToDistance(decimals, latitude)? If no latitude is specified, we could output a message explaining how precision changes with latitude, and mentioning the latitudes of two cities with very different values?

Hi @jywarren https://github.com/jywarren , how to implement this ?

What does distance here refers to ? Thanks 😄 !

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/publiclab/blurred-location/issues/4, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJzL2pyne_Fq8urWN0XOD3HVLKzFTks5vWphQgaJpZM4b09gA .

sagarpreet-chadha commented 5 years ago

Okay so we input the latitude and the distance in meters from that latitude line ? And we output the precision one should give to the coordinates so that given distance is covered by the bounding square ?

jywarren commented 5 years ago

Ah, ok, i think we have to make this more clear. I see what you're doing in #6 and that does make sense. However, the idea is not to take the number of decimal places as the precision, but to try to quantify how big a grid square is at the given precision. So for latitude with 2 decimal places, like 14.04, that'd be x meters by y meters wide.

But there's some ambiguity -- should we use just the latitude, and rename this method? That makes it less useful, maybe. Or should we say something like the precision you should choose so people would be able to find your location to within X meters -- and how would we write that as a simple function name?

Thank you for helping me to figure out that this is more complicated than it seems! What do you think?