Matt Saddington
Matt Saddington

Reputation: 151

highlight building google maps v3

Im trying to highlight specific building within a map using the google maps v3 api. I was wondering if anyone had any idea how to do this. I've been looking through google api documentation and come across nothing at the moment.

For example: http://goo.gl/maps/GyrDB - This is a map of a section manhattan, as you can see the 3d building. Im trying to highlight specific ones on hover.

Thanks :D

Upvotes: 3

Views: 2712

Answers (2)

Marco Marsala
Marco Marsala

Reputation: 2462

In many countries, every building is a cadastral parcel and there Web Map Service (WMS) layers showing them, provided for free by state bodies.

Using these layers, you can get building polygon coordinates. For ex: https://snag.gy/WtU7ZT.jpg

Upvotes: 0

Kaitlin Duck Sherwood
Kaitlin Duck Sherwood

Reputation: 627

If you have information about where the building is, then you can use a Polygon to highlight it. If you don't have information about where the building is, then you are probably out of luck. The Google Maps API doesn't have any way of interacting with the map at that level.

Now, I suppose that one thing you could do is:

  • download the Google Maps tile,
  • find the point in the image that the user clicked on,
  • do a flood fill of that point with some awful colour,
  • set to clear all the pixels which are not the colour,
  • overlay that image on top of your map

You would also need to be clever about buildings which lie in more than one tile.

HOWEVER, this might run you afoul of the Terms of Use. I know that they disallow modifying the artwork; I am not sure if this would count as modifying the artwork; you'd need to look carefully at the TOU and maybe ask a lawyer. Or ask Google. (Don't ask me, I am not a lawyer.)

Upvotes: 2

Related Questions