Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
    
Related: stackoverflow.com/questions/7570313/… –  Mapperz Nov 14 '12 at 15:31
add comment

2 Answers

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.

share|improve this answer
add comment

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

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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