Search code examples
javascriptextjsopenlayers

add layer in extjs , openlayers


i am working with extjs and openlayers for trying some web application. now i want to create a coordinate bookmark which click than take this coordinate...

but first of all, it must create a layer in which name is "Bookmarks"..when you click on it ita take to the this coordinate...

how can add a layer in which name is "Bookmarks" and how can i go taking coordinate from map...


Solution

  • If I understand your question correct, you will need a vector layer to display the bookmarks:

    var my_bookmark_layer = new OpenLayers.Layer.Vector(
        "Bookmarks",    
    }, {
        displayInLayerSwitcher: true
    });
    map.addLayer(my_bookmark_layer);
    

    This will add an empty layer which You can use later on.

    To get a coordinate from the map, see this example in the OpenLayers example folder. Then you will need to store the coordinate as a feature in the bookmark layer.

    Hope it helps :)