Google maps - how to get building's polygon coordinates from address?

Konstantin Chernov picture Konstantin Chernov · Mar 23, 2011 · Viewed 13.6k times · Source

How to implement the following:

  1. User defines an address
  2. User defines a color
  3. Service searches for a corresponding building on the google map
  4. Service fills the found building on the map with the color

I know how to:

1.find lat/long of the address

2.draw the polygon

So, to do the task I need to get polygon coordinates of building from address. How to?

Answer

user1564486 picture user1564486 · Aug 4, 2013

(1) Acquire image tile

original

(2) Segment buildings based on pixel color (here, 0xF2EEE6).

parsed

(3) Image cleanup (e.g. erosion then dilation) + algorithm to acquire pixel coordinates of polygon corners.

(4) Mercator projection to acquire lat/long of pixel