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.
var vectormap = new OpenLayers.Layer.Vector('Overlay',
    {
        styleMap: new OpenLayers.StyleMap(
        {
            "default": new OpenLayers.Style({
                           externalGraphic: 'girl.png',
                           graphicWidth: 50,
                           graphicHeight: 50,
                           graphicYOffset: -24,
                           title: 'marker'}),
            "select": new OpenLayers.Style({
                           externalGraphic: 'boy.png',
                           graphicWidth: 16,
                           graphicHeight: 26,
                           graphicYOffset: -24,
                           title: 'marker_select'})
        })
    });
featurearray = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(113.950,33.019));
vectormap.addFeatures([ featurearray ]); 

This is my vector layer, but a bit wrong, my png image title attribute can not be displayed when the mouse to move up, I checked the official website the "OSM with Marker and Popup.html" code, exactly the same, you know why, thank you!

share|improve this question

1 Answer 1

It looks like you are using canvas but title option does not supported by the canvas renderer. Try to configure you vector layer following way:

var vectormap = new OpenLayers.Layer.Vector('Overlay',
{
    styleMap: new OpenLayers.StyleMap(
    {
        "default": new OpenLayers.Style({
                       externalGraphic: 'girl.png',
                       graphicWidth: 50,
                       graphicHeight: 50,
                       graphicYOffset: -24,
                       title: 'marker'}),
        "select": new OpenLayers.Style({
                       externalGraphic: 'boy.png',
                       graphicWidth: 16,
                       graphicHeight: 26,
                       graphicYOffset: -24,
                       title: 'marker_select'})
    })
    renderers: ["SVG", "VML", "Canvas"]
});
share|improve this answer
    
Oh,my god, my openlayers version is wrong. . .sorry! –  harryfly Jan 29 '13 at 3:13

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.