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 am new to GIS, openlayers, geoserver.... I managed to create simple vector layers using openlayers api. My question is how to save, for example vector layer, in order to use it later?

Thank you in advance.

This is the code:

var map;

    function init() {
       map = new OpenLayers.Map('map_element', {});

       // Setup our two layer objects
        var wms_layer_map = new OpenLayers.Layer.WMS(
        'Base layer',
        'http://vmap0.tiles.osgeo.org/wms/vmap0',
        {layers: 'basic'},
        {isBaseLayer: true}
        );

        var wms_layer_labels = new OpenLayers.Layer.WMS(
        'Location Labels',
        'http://vmap0.tiles.osgeo.org/wms/vmap0',
        {layers: 'clabel,ctylabel,statelabel',
        transparent: true},
        {visibility: false,opacity: .5}
        );

        var wms_state_lines = new OpenLayers.Layer.WMS(
        'State Line Layer',
        'http://labs.metacarta.com/wms/vmap0',
        {layers: 'stateboundary',
        transparent: true},
        {displayInLayerSwitcher: false,
        minScale: 13841995.078125}
        );

        var wms_water_depth = new OpenLayers.Layer.WMS(
        'Water Depth',
        'http://labs.metacarta.com/wms/vmap0',
        {layers: 'depthcontour',
        transparent: true},
        {opacity:0.8}
        );

        var wms_roads = new OpenLayers.Layer.WMS(
        'Roads',
        'http://labs.metacarta.com/wms/vmap0',
        {layers: 'priroad,secroad,rail',
        transparent: true},
        {transistionEffect:'resize'}
        );


        var t2 = new OpenLayers.Layer.Vector(
        "T2",
        {
            strategies: [new OpenLayers.Strategy.Fixed()]
            , projection: new OpenLayers.Projection("EPSG:2000")
            , protocol: new OpenLayers.Protocol.WFS({
                version: "1.1.0",
                url: "http://localhost:8080/geoserver/wfs",
                featurePrefix: "t2", //geoserver worspace name
                featureType: "t2", //geoserver Layer Name
                featureNS: "http://opengeo.org/t2" // Edit Workspace Namespace URI
                //geometryName: "the_geom" // field in Feature Type details with type "Geometry"
            })
        });

        map.addLayers([
        wms_layer_map,
        wms_layer_labels,
        wms_state_lines,
        wms_water_depth,
        wms_roads,
        t2]);

        map.addControl(new OpenLayers.Control.LayerSwitcher({}));

        if(!map.getCenter()){
        map.zoomToMaxExtent();
        }
    }

All the layers are visible, execpt t2. Could you help me?

share|improve this question
    
    
What do you mean, when you say: 'save in order to use it later'? Can you clarify? –  Devdatta Tengshe Apr 17 '13 at 16:29
    
I want to create vector layer with polygons and to save it. After that to use it when i will need it. Thank you –  user17243 Apr 18 '13 at 12:36

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.