6

I just made the switch from Google Maps V3 to OpenLayers. I realise that OpenLayers API uses a lot of inline styling. If an image file consisting of several images can be used, it would cut down server request. Has anyone implemented this on marker icons of varying sizes?

2

To my understanding you are implementing a marker layer. Should this be the case, in my opinion the answer is 'No'.

In OpenLayers a marker layer can be implemented by using a layer of type Marker (class OpenLayers.Layer.Markers) or by using a vector layer (class OpenLayers.Layer.Vector). The latter is the recommended one.

In case you use a layer of type markers, you will have to assign each marker an icon. Each icon is an instance of the class OpenLayers.Icon, and the picture used as icon only can be set by giving its URL (see the example 'Markers Layer Example').

In case you use a layer of type vector - there is a very simple example in my blog -, the style of each feature (or marker) is set using a SLD style, a "hash of style properties". To my understanding, the implementation of SLD styles that OpenLayers features do not implement clipping sprites.

0

Openlayers Example using Sprites

The sprite is located here http://maps.peterrobins.co.uk/files/edit_sprite.png

The map controls the position of each marker via .editPanel div

Working Example: http://maps.peterrobins.co.uk/files/ol6.html

  • The example shows sprite implemented for panel control. This is not the same as implementing sprite on markers. – Question Overflow Nov 15 '12 at 3:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.