On 07/07/2009, Andrew Leach <[email protected]> wrote:
>
>  On Jul 7, 3:04 pm, rohit <[email protected]> wrote:
>  > Hi,
>  >
>  > I have the exact geo-codes in my database. But I need to show a marker
>  > which is only a vicinity spot (say 2 miles away from the exact
>  > location). This is needed for location privacy. How can I best achieve
>  > this?
>
>
> If you want the actual location to remain private, you cannot send it
>  to the browser, so any randomisation must be done server-side. This is
>  what I do in PHP:
>
>   // Add the fudge factor to frustrate data-scraping of the geocoding
>   // This moves the point up to 300m (0.004250deg) away. Should still
>  be ok
>   // for map centre.
>   $px=$px+((mt_rand(0,8500)-4250)/1000000);
>   $py=$py+((mt_rand(0,8500)-4250)/1000000);

But be careful *when* in the process you do that.

This can work quite well for something like randomising a geocoder
output - where really there is other sources of data that can be more
appealing. But by repeated requests to this service where the
randomization changes each time, after multiple requests can determine
the actual value quite accuratly.

For 'fudge'ing database values, its better to either A) calculate the
random fudge once per row, and store in the database. Then at output
time, use real+fudge to display the coordiante.

or B1) Alternatively use some sort of basically random, but
deterministic fudge, at display time.

A good way would be to just call srand($row['id']*2456+7578) or
similar first, which will cause a repeatable sequance. Those numbers
are just to add a secret key.
(dont forget to do a srand(time()) afterwards so other random numbers
again are fairly random)

B2) Another is to use a Reverse Geocoder to get the value you return
to the user. The user then gets an position, but doesnt know the real
location nor how far it was from the 'fudged' one. Can use the
accuracy param of the geocoder, to use a high enough level reutnr.


A reverse Geocoder has the addad advantage of not 'wandering' - if you
use the random fudge on a series of values - say a user track,
following the average track, the original track could basically be
determined. A reverse geocoder based one will normalise all results in
an area to a common point, so really dont know the real location, but
you dont get any indidcation of small movements.


>
>  Just change the numbers for your desired distance and latitude (since
>  metres per degree depends on latitude). 300m is 0.004250deg at around
>  51deg latitude. Note that this moves the spot by *up to* 300m in any
>  direction. It could still place the location in exactly the right
>  place -- but that's very unlikely, and no-one will know if it is or
>  not.
>
>
>  Andrew
>
> >
>


-- 
Barry

- www.nearby.org.uk - www.geograph.org.uk -

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to