简体   繁体   English

在extjs,openlayers中添加层

[英]add layer in extjs , openlayers

i am working with extjs and openlayers for trying some web application. 我正在与extjs和openlayers一起尝试一些Web应用程序。 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... 如何添加名称为“书签”的图层以及如何从地图获取坐标...

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. 要从地图获取坐标,请参见OpenLayers示例文件夹中的此示例 Then you will need to store the coordinate as a feature in the bookmark layer. 然后,您需要将坐标存储为书签层中的要素。

Hope it helps :) 希望能帮助到你 :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM