Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

add css to google maps v3 polylines?

is there any way to customise google maps v3 polylines I think the only options mentioned are strokecolor, weight and opacity http://code.google.com/apis/maps/documentation/javascript/reference.html#PolylineOptions


1 Answers

As far as I know, the only options to style Google's polyline are the ones presented in the documentation. There is no way to customize them further by default.

However, what might work is creating a custom polyline class where you can define everything you want, but this is connected to a lot of work. You would have to start by inheriting the OverlayView class and implement all the needed features (Maybe it does also work if you inherit Polyline and overwrite just the drawing methods - the problem is, you don't really know how the original source code looks like).

In fact, for Google Maps V2, Bill Chadwick did this. You can see a demonstration on his website (the dashed polyline example at the bottom). Maybe his implementation helps you to transfer it to Google Maps API V3.

like image 101
Martin Matysiak Avatar answered Jan 30 '26 11:01

Martin Matysiak



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!