How to approximate user location on IP&Geoloc maps I'm using the combinaison of this modules :


Address field
Geofield
Ip&amp;Geoloc
Leaflet


I need to approximate the location of user's markers on the map for privacy reason. 

For exemple if somebody live at 123 addressstreet 10000 Washington I want the marker on leaflet map to point a random location in the area of this address and not the real geocoded location.

What's the best way to do that ?
So, there's probably several ways to do this and your approach will depend on exactly what your needs are for this app.

If you need to preserve the geofield data accurately in the db, but you just want to change the display, you'd need to write a script to modify the Leaflet JS create.point function. This is complicated because you'll have to consider things like the visual context of what you're mapping (i.e. if there's only one house in an area, then even abstracting the location won't really accomplish what you want). Also, your changes will get wiped if your not careful upgrading modules potentially exposing the addresses your trying to hide (depending on how sensitive your data is, this may expose it as well, because someone might be able to dig through the JS and extract the original coordinates). This is also complicated, because simply randomizing the lat-lon data will produce really wonky map results (here's an alternate approach to randomizing user data. I would think that a good approach would be to choose a distance offset, and then randomly apply it to either the lat or lon value. This will keep your point close to where it should be, but it will be offset on either the X or the Y axis to the point where it shouldn't be on the exact location. You could also take the approach where you mis-match the real locations of the users to other users.

If you don't need to store the Lat-Lon accurately, you could write a custom module to hook into the geofield_compute_location function and apply your offset there. This will keep your addresses intact and then apply a similar function to the lat-lon values returned by whichever service is providing your geocoding. This will give you obscured location data to pull into your view.

There's also probably a way of modifying the geocoding request to only provide city-level accuracy, but this is getting over my head.

Hope this helps.