2

I got this question asked in a startup

If you are asked to design Maps like Bing Maps how would you estimate the space complexity ?

The only answer I could think for maps is, the space was constant, but I was not really sure if I went in the right direction.

How to approach such a question ?

Vinoth Kumar C M
  • 10,378
  • 28
  • 89
  • 130

2 Answers2

1

If you check out the details of map services, you'll notice that they have several layers. For each layer, you can estimate the size based on the resolution of your source data, and the area that they cover:

size = sum(foreach layer: layer.area * (layer.resolution)^2 * layer.elementsize)

Satellite images are the easiest to compute, as you'll want worldwide coverage at some basic resolution level. But you can expect some source material to be focused on regions of interest, like aerial photography; these will presumably be higher resolution, but smaller in total area.

You will want to save reduced-size versions of your full-resolution data, in order to provide zoomed-out displays conveniently. However, this should only occupy a fraction of the space required by the full-resolution data. Every factor-of-2 reduction in image size will reduce the size of the additional data by a factor of 4; the additional size of a factor-of-2 image pyramid will be 1/3 of the full-resolution data.

Finally, you'll also need geographic information, like roads, geographic regions, and points of interest. The size of this data is naturally very elastic, but you can probably get some sort of rough estimate by evaluating the size of a commercial geographic database for a particular city, and scaling by population.

comingstorm
  • 25,557
  • 3
  • 43
  • 67
0

Let's say when look at the map with zoom 0 (where entire planet could be seen) and the map is divided into X images.

Then you zoom to 1, and now you have the same X images to display current area, but this is will be just part of the map. Let's say you need to view Y parts in zoom 1 to "cover" entire planet. This means you should view X * Y images. Bing Maps has something about 21 zoom levels, so you should have X * 1 + X * Y + X * Y ^ 2 + ... + X * Y ^ 21 = X * (1 + Y + Y ^ 2 + ... + Y ^ 21) and this results to estimate O(X * Y ^ 21).

Plus you should take into account that some data required to describe addresses, roads, traffic. This could be computed approximately, by using some statistical data.

Pavel Podlipensky
  • 8,201
  • 5
  • 42
  • 53