Giter VIP home page Giter VIP logo

publiclab / leaflet-blurred-location-display Goto Github PK

View Code? Open in Web Editor NEW
11.0 11.0 12.0 12.74 MB

A library to display points which have been "blurred" for privacy with leaflet-blurred-location

Home Page: https://publiclab.github.io/leaflet-blurred-location-display/examples/index.html

License: GNU General Public License v3.0

JavaScript 52.00% HTML 48.00%
javascript leaflet maps privacy

leaflet-blurred-location-display's People

Contributors

aliciapaz avatar daemon1024 avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar faithngetich avatar jywarren avatar mridulnagpal avatar nstjean avatar rexagod avatar sagarpreet-chadha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

leaflet-blurred-location-display's Issues

Follow-up issues for LBLD docs

Just collecting some here!!! ๐Ÿ‘

Progress to date is really tremendous, @sagarpreet-chadha! You've done an incredible job. I'm now giving it a fresh look, and thinking about what could come next. Would love your thoughts on these!!!

  • Color code the markers on the map according to the precision. -- actually this was just to demonstrate the principle in the demo; we could keep it as a feature but I had imagined not being a default behavior. What do you think, @sagarpreet-chadha ?
  • Can we add a couple screenshots from the blog post into the README to illustrate?
  • Under https://github.com/publiclab/leaflet-blurred-location-display/blob/main/README.md#basic, we should maybe say First, you need to make some blurred locations. Let's create 3 of them and add them to the map. and then show how to create three and add them in as short a code segment as possible. One thing I'm wondering is how the options_display is passed into the constructor and we could show that more clearly in the "Basic" section!
  • could we have a constructor option to switch between heatmap and marker mode? Like:
blurredLocations = new BlurredLocations({
  style: 'heatmap' // or 'markers' or 'both' ?
});

Possible changes

  • does options.locations auto-generate the BlurredLocations? Why do we make only one blurredLocation? It kind of seems like we should make one for each coordinate pair, using this syntax?
  • Actually, perhaps we need to change the syntax of the BlurredLocation constructor so it can be added to a map the same way a standard Leaflet object is added, with `addTo(map) as in these instructions -- sorry, that would be a breaking change, I suppose... but in the spirit of making it a 'normal' Leaflet object?
  • locations_markers_array - maybe we should rename this getVisibleLocations()?
  • SourceUrl_markers_array is this the same as above but for remote locations? What if we instead just added a property to each location like source: 'remote' and then only used the above getVisibleLocations(); method instead of having 2?
  • could getMarkersOfPrecision likewise return just 1 array?
  • could we illustrate precision by referencing the chart in https://github.com/publiclab/leaflet-blurred-location#human-readable-blurring ?
  • let's open an issue to add the ability to pass an array of precisions or a range (not sure how, maybe { min: 0, max: 11 } into getMarkersOfPrecision() -- we don't have to implement it, but it'd be a nice next step later.

OK, this is a lot! But it's so exciting to have come this far!!!

Integration with plots2 .

We only need to integrate it to /people for now .

The current LBLD API definition looks fine , we just have to pass BlurredLocation object AND integration is done ๐Ÿ˜„ !

What more changes should be done to make LBLD API more easy to integrate ?

Add list of users to popup for grid squares

You can now see this library on by default at:

https://stable.publiclab.org/map#7/41.14399650184958/-71.81762695312501

I'd like to suggest we list the people in the grid square when you click it. RIght now it just says "Number of Markers" but we should show a list of usernames, each linking to the corresponding profile URL like: https://publiclab.org/profile/<USERNAME>

image

Here is the code which generates this popup:

let r = L.rectangle(bounds, {color: color , weight: 1}).bindPopup('Number of Markers : ' + ctr).addTo(map);

While we're at it, let's remove the "precision" line from the regular marker popup too:

m.addTo(map).bindPopup("<a href=" + url + ">" + title + "</a> <br> Precision : " + precision) ;

We'll also have to adjust the corresponding test, here:

var r = L.rectangle(bounds, {color: color , weight: 1}).bindPopup('Number of Markers : ' + ctr).addTo(map);

We'd love help with this!

User visible when blurred is set to true at some zoom levels

@daemon1024 observed this; we should compare it to the described policy in the README in this repository and check if something is wrong. It still wouldn't be exposing private location data (since the principle is that we don't even store it) but it might be giving the impression of higher precision than we actually have.


simplescreenrecorder-2021-07-28_02.57.58.mp4

Observed a weird thing. The user here has blurred set to true, but we can see them at some particular zoom level ๐Ÿค”

Originally posted by @daemon1024 in publiclab/plots2#7556 (comment)

Planning issue .

Task List โญ๏ธ :

  • 1. A spec for describing the precision of location data in human terms

    • this wouldn't need to be incredibly formal, but we would basically try to write out a very precise and clear description of the role LBL fulfills, abstractly. It could include very clear examples of how location is blurred and how much precision it "degrades" for each level. Does this make sense? [ solved in #65 ]
  • 2. A utility library for filtering locations to a specific precision level

    • this would be a mini sub-node module broken out of LBL that could be re-used in LBLD, and also in other apps, that would just do the conversions - no UI or geocoding or anything! This should be pretty easy and could have a set of tests to demonstrate how it works (that could overlap a lot with the spec task above)

600+ weekly downloads on NPM :)

I was checking the version number on NPM and saw that last week we had 623 downloads on NPM and currently 500+ downloads this week :)

Screenshot 2019-07-14 at 11 30 30 AM

Happy Coding ๐ŸŽ‰ !

Initial Update

The bot created this issue to inform you that pyup.io has been set up on this repo.
Once you have closed it, the bot will open pull requests for updates as soon as they are available.

Heatmap or aggregate means of displaying locations

  • explore heatmap or aggregate means of displaying locations that, for example, fall in the same grid square, using varying shades to indicate density

  • explore above heatmap display (configurable with a constructor parameter) with ability to click on a grid square to expose a list of points within that square

I guess to get started :

  1. We should make a function to get current grid square coorindates .

  2. Make a function which uses the API to return the number of markers within that grid square .

@jywarren ...what should we do next ?

Add/remove markers as zoom level change .

Reference : #9 (comment)

So does this make sense? That in this library, as you zoom in, some locations appear only within some zoom levels, that are close to the precision they were entered in? If they have lots of precision, they might appear in many zoom levels, but if they are very imprecise (highly blurred), they would be hidden once you zoom in too far.

We could write a test to check for this -- so it would start the map up, go to a certain zoom level, and check what's visible, then zoom in further and check again, for 3 or 4 zoom levels. Then we could write the functions of this library to ensure that the markers are properly displayed for those given zoom levels.

Get current rectangle coordinates .

In LBL , we know the interval between grid for different zoom levels .

screenshot 2019-02-05 at 4 38 36 pm

From leaflet we can calculate centre of map and get coordinates .

BlurredLocation.map.getCenter() ;

Using the interval and centre coordinate => we can calculate the current rectangle .

STEPS :

  • Truncate the centre coordinate according to current interval (between grid coordinates [see pic above]) .
  • This truncated coordinate is the bottom-left coordinate .
  • Adding/subtracting 10 ^ (-1*interval) to it , all 4 coordinates can be achieved .

Segregation/Standarization/Documentation of code .

  • let's separate out the UI code like popup code from the data management code using require() .

  • let's clarify what happens when local static data AND remote url are both provided, or move to do only one or the other per layer .

  • standardize the method names returned by the constructor function to be more readable and clear .

  • make some functions like getMarkersOfPrecision(int) and filterCoordinatesToPrecison(int) .

Adding a README.md

In this we can tell the users about the privacy statement that there location won't be displayed if the current precision is greater than the user's location precision.

Make getVisibleLocations() .

locations_markers_array - maybe we should rename this getVisibleLocations()?
SourceUrl_markers_array is this the same as above but for remote locations? What if we instead just added a property to each location like source: 'remote' and then only used the above getVisibleLocations(); method instead of having 2?

@jywarren ,
To make code more modular --- we have implemented separate listeners (panning and zooming) for Local data and Remote data , hence we have made separate arrays - locations_markers_array and SourceUrl_markers_array in order to avoid Race Condition between the different listeners .

Hence we have these 2 functions that are useful :

function return_locations_markers_array(){

function return_SourceUrl_markers_array(){

We can make a function getVisibleLocations() which basically combines the data from these 2 arrays and returns it in the form :

Screenshot 2019-04-07 at 4 54 05 PM

Now for all future purposes , we can use only this function . What do you think ?

"recently used locations" feature

  • 1.) A second one is - tell me what you think, but the idea of "recently used locations" as a way to speed up the Leaflet Blurred Location modal; we could, on plots2, look up recently added location tags and offer them as a way to quickly add location.

  • 2.) We might also use the most recent location as the default location that appears when you open the LBL modal, so it sort of assumes "near the last place you input".

Hi @jywarren ,
I like this idea very much ๐Ÿ˜„ . Let's discuss here how to do it on plots2 ?

So should we make a function in plots2 that calculates the recent 5 unique places (we will get latitude and longitude also from the power tags) used by current user ?
or
calculates the recent 5 unique places used in general in publiclab.org ?
or
maybe recent 5 places which are used maximum number of times in publiclab.org ?

What do you think ?

Weekly Community Check-in #23 - "Don't Give Up"

Hi everybody ๐Ÿ˜ƒ !

We all at Public Lab ๐ŸŽˆ - learn, grow, work, brainstorm ideas, contribute together so why not share about our weekly goals and the awesome work we have done at Public Lab with each other, so we can support and collaborate with each other better. We have a Community Check-In each week, where every community member can share something about their work from the past week and about their current week's goal ๐ŸŽฏ . You are also welcome to share fun-fact ๐Ÿ˜„ , new ideas ๐Ÿ’ก , your learning goals โ˜‘๏ธ .

We believe in collaborative efforts to support our community. We are running a learning platform which helps a newcomer to become master of tomorrow. ๐Ÿ’ฏ

If you're new here, welcome, and please comment a Hello below, we would love to work with you. If you're looking for new issues, please try some of our first-timers-only issues.

We're SO EXCITED to have your help!

Is there anything, you would like to share with us from past week's work? What is your plan for this week?

If you have not planned yet, just leave a Hello! ๐Ÿ‘‹ so that we know that you are in sync with us ๐Ÿ”ƒ and doing well!

The coming weeks will be full of code ๐Ÿ’ป , tasks ๐Ÿ—’๏ธ, fun ๐ŸŽ‰ and excitement ๐Ÿ˜ƒ!!

As always, if you're waiting for a review, or if you're stuck, please request help here OR leave a comment with @publiclab/mentors @publiclab/reviewers for some input. ๐Ÿ™Œ

Gitter

Gitter is an active chatroom in our community and we'll be sending weekly reminders about check-ins there. Be sure to sign up there for these updates or just to join the conversation. You can also join us through http://publiclab.org/chat ๐Ÿ’ฌ.

This week's theme

The theme for this week is - "Share your challenges and grow together". ๐Ÿฅ‚ We all are part of this supportive community wherein we take tasks that are totally new to us and every task or some particular ones bring new challenges, share your recent challenges and how you kept fighting to get your task done and experienced that gush of happiness.

Recently I faced it with "Text over Image" feature in image sequencer wherein things were consistently messy, sometimes the image disappeared and the other times the font. But this was my feature, and I was not ready to stop. ๐Ÿ™‡โ€โ™€๏ธ I kept on trying posts and debugging for issue areas. Finally, the persistence paid off and I made it!! ๐ŸŽ‰ I have learned that a dead end is only when you stop trying. If you want something, set your mind to it keep on challenging yourself to do it.

For the soc students especially, the months ahead will be a challenge but follow "Plan, conquer and enjoy" ๐Ÿ’ƒ

I would love everyone to share their experiences.

You can find our list of previous check-ins here

Note to Summer of Code interns:

Hi, we request all the SoC students to include the below-mentioned points in their check-in comment:

  • FTOs created in the previous week
  • Progress for your project
  • Upcoming week's goals
  • PR reviewed by you in the previous week
  • Work completed last week.
  • What things you did collaboratively last week? This is really important we want team spirit.
    It is like a weekly scrum. Be flexible.
  • Feel free to tell us about your absence too, if you're taking a break.
  • Issue/PR you're struggling with (if any)

With FTOs and PR reviews, we are seeking to develop a much more friendly and collaborative platform. We want you all will involve people in your project. You all will develop skills like leadership along the way.

Thank you!

'n' LBLD objects for 'n' coordinate pair ?

From #64 ,

does options.locations auto-generate the BlurredLocations? Why do we make only one blurredLocation? It kind of seems like we should make one for each coordinate pair, using this syntax?

Hi @jywarren ,

  • So currently we have this options.locations property which takes an array of coordinates as input and then performs the normal LBLD functions on them .

  • We are making only one LBL and one LBLD object currently . We pass the map object as options to the LBL object , and then this LBL object in options_display to LBLD object .

I think options.locations property gives user more flexibility . So if one do not want to pass their API URL and JSON parser into the LBLD library (as we do not support XML parsing and others) , so instead one can pass the coordinates array (locations array) directly into the LBLD object . Makes sense ?

Kindly elaborate more on this issue ๐Ÿ˜„ ! Thanks !

Shaded grid should always show

The demo looks great!

image

I noticed that if you zoom in one more step, the green marker disappears, which is correct, but the shaded square it's in also stops getting shaded. Actually I think the shading should appear for all zoom levels, does this make sense?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.