I'm trying to generate a synthetic dataset which resembles a real dataset. (The real dataset can not be distributed due to data privacy issues, so I need a synthetic test dataset which I can hand out.) In particular, the original dataset contains street addresses. Those addresses need to be obscured.

I've approached the problem by geocoding the addresses in the original dataset, approximating the distribution of the (lat, long) pairs so generated, and taking a random sample of synthetic (lat, long) pairs from that distribution.

Now I need to convert those pairs back to addresses which can be embedded in the synthetic dataset.

Obviously, that won't work unaltered, since the synthetic (lat, long) pairs will rarely correspond to a street address. I propose to solve this by taking each of these synthetic pairs, finding a nearby packet which has an address, and then using the address of that packet as the address of the entry in the synthetic dataset.

So I'm left with the following question:

"Given a (lat, long) pair, find the street address of the nearest postal destination."

That can be reduced to the following, simpler question:

"Given a (lat, long) pair, find the centroid of the nearest postal destination."

I assumed that I could use the faces table to find a candidate centroid, but I'd need to restrict the faces table to records that actually represent a packet. How could I do that?

Edited to add:

Point-by-point obfuscation doesn't work in a case like this because of isolated points: if an address is very remote from other addresses, then rounding, truncating, or randomly sampling near that address still gives an attacker a way to find the original address with high probability.

I'm using a more subtle method: I'm building a continuous distribution across all addresses in the input set and picking a random point according to distribution. This has the disadvantage that the points selected will rarely, if ever, correspond to actual addresses; that's the disadvantage I'm trying to solve.

  • 1
    why not pick at random from addresses in the area and then geocode that address?
    – Ian Turton
    May 20, 2021 at 16:49

2 Answers 2


Obfuscating the address by taking a round (for exemple) can lead to problems where you have isolated points. Usually with obfuscation either you have possible issues with privacy either your data is not realist.

I see 2 options:

  • if you don't need to have some consistence and realism in your data (you don't need to have a link, even blured, between your data and your address):
    • you can just take a random list of address, or generate random point and take their address with an external API (like google) or a self hosted service like nominatim
    • here I'm assuming that giving the real addresses from your data, even if it's not the same row (so you're not linked with the rest of the data) is still a potential issue, because it still contain the information that there is a packet delivered here, and that one of the other rows have the corresponding info.
  • if you still want some consistency, and basically "blur" your adress, like I said you need to be carefull with isolated points. You can take a look at this article for exemple that explain a way to generate a point which can definitly not be found between at least 2 other of you points. It handle crowded zones for your points (and avoid having a lot of rows with the same address) as well as isolated zones. If you need an address from your point, same thing that the first point.
  • Absolutely correct -- if you obfuscate by rounding, then you have problems with isolated points. That's why pointwise obfuscation doesn't solve the anonymization problem. If, however, you have enough points overall and you approximate the probability distribution of all points, then the connection between any given item and its obfuscated replacement is completely lost.
    – JWLM
    May 21, 2021 at 15:49

I solved it by looking at the PostGIS geocoding code in detail.

It turns out that there's no way to actually get the parcel for a given address; that's suppressed for privacy reasons, which means that the geocoding code can not actually use the true location of each parcel. Instead, it finds road segment containing the address in question, and then does a spherical interpolation along that edge to create a synthetic approximation of where the "point ought to be".

That method can be reasonably approximated given a lat-lon point: find the nearest edge, and then interpolate along the house numbers on that edge to compute a point along that edge. We can make that even easier: instead of trying to compute a realistic estimate of the house number, we can simply take the median of that edge and then offet it from the edge by 10 meters on the appropriate side.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.