# Differentiating a building from a road on a map?

This question was originally asked here by Steven and I felt the question was better asked here. Steven would also like to know the sources Google buys it maps from. I remember seeing a post about it on this forum, but couldn't find it when I searched. Please do help...

-
Thanks for your answers, everyone. Steven? – Nav Dec 22 '10 at 3:55

The answer depends on how the question is interpreted. One interpretation is,

"Given that a GPS point is known (or assumed) to lie either on a building or on a road, what are the odds that it lies on the road?"

To find this, compute a grid representing a 2D Gaussian function whose standard deviation equals the expected error in the GPS position. Use a cellsize small enough to represent both the building and the road adequately: 2 meters or less should be reasonable in most cases. For example, when the GPS position has coordinates (u,v) (in meters, using a projection that is reasonably close to conformal) and the expected error is 5 meters, the Gaussian as a function of coordinates (x, y) is proportional to

Exp( (-1/2) * ((x - u)^2 + (y - v)^2) / 5^2 ).

Compute the zonal sums of this grid over the road and over the building. (This procedure works for either vector or raster representations of the road and building. A vector representation of the road as a polyline should be buffered to the width of the road.) The ratio of these zonal sums gives the odds. For example, the zonal sum over the road might be 2.4 and the zonal sum over the building could be 1.6. The odds for the road are 2.4 : 1.6. Thus, the probability that the point is in the road is 2.4 / (2.4 + 1.6) = 60% and the probability the point is in the building is 40%.

Even when it is clear from the map that the GPS point lies in the building or on the road, this procedure does not return 100% for either one of these events. This is as it should be: it's possible, due to error, for a GPS point taken in a building to appear to lie on a nearby road and vice versa.

-
I'm pretty much perpetually in awe of your answers. – Matt Parker Dec 21 '10 at 16:27
Also, if you're moving, you can add factors to your assumptions - especially (say) parallel to the road at 50 km/h. – mwalker Dec 21 '10 at 20:05

hallo

first, in the post in stackoverflow the discussion is about getting a GPS point and say if it is a building or a road. AFAIK, GPS does not have that precision. I never expect a GPS point to be more precise than 10 meters. of course it often is a little better than that but it can also be much more wrong. In Routing GPS units the software often snap the point to the closest road if it is in range. So the precision in the GPS is much worse than it looks.

So, the point is that deciding if a point is on the road or in a building next to the road is hard.

If the question only is about google maps I don't have any answer to the actual question. But in more general terms there is some words to say.

If the map you are working against is a vector map and the roads is represented by linestrings you will have problems finding that line with a point even if the point has very good precision. That is because the linestring has zero-width. so I guess the best approach is to seaarch around the point in a radious of, say 20 meters and find all roads and buildings and then go for the one closest to your point.

But remember, if it is GPS point the point can be in the middle of the house but if was actually catched on the road passing by.

If the map you are working against is a raster or some other type of image, it is all about image analyse which is another story.

/Nicklas

-

I haven't got a full answer but an important point is the context of the building and the road. GPS accuracy falls dramatically in a very built up area because the radio signals are obscured by and bounce off buildings. So GPS readings in the country by a low building will be far more accurate than in a skyscaper 'canyon' as you get in major cities.

-