We are using cartodb.js with Google map v3. We are trying to highlight the polygons on mouse-hover. Is there a way to highlight the polygon on Google map using cartodb layer?
[GIS] cartodb.js highlight the polygons on mouse hover for Google map v3
cartocartographygoogle maps
Best Answer
One of the things you can do is request the geometry from cartoDB as in a geoJSON format as part of your SQL query:
Google can take the geoJSON and convert it to polylines and polygons each time you mouse over a feature. Here's an example I've done with a polyline. You could do the same thing with a polygon, but use google.maps.Polygon() instead.
First create your shape (I created a global one so I could edit it easier).
For more information on doing this with a Polygon, check out the Google Maps API (https://developers.google.com/maps/documentation/javascript/examples/polygon-simple)
Then this code would be used as part of your cartoDB featureover callback (via http://docs.cartodb.com/cartodb-platform/cartodb-js.html#create-a-visualization-from-scratch) :
Don't forget to make sure your cartoDB interactivity is turned on.