O'Reilly logo

OpenLayers Cookbook by Antonio Santiago Perez

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a custom renderer

When working with vector layers, styling is a great feature which offers us a lot of possibilities: fill color and opacity, stroke color, labels and text colors, and so on. But, what if we need more?

Every OpenLayers.Layer.Vector instance contains a renderer that is responsible to render the layer's features (such as points, paths, and polygons) on the map using the best technologies available in the browser. These can be the HTML5 Canvas element (http://en.wikipedia.org/wiki/Canvas_element) available in many modern browsers (such as Firefox or Chrome), SVG (http://en.wikipedia.org/wiki/Scalable_Vector_Graphics), or VML (http://en.wikipedia.org/wiki/Vector_Markup_Language).

When OpenLayers.Layer.Vector is initialized, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required