view browse map - GeoSmartCity-CIP/gsc-client GitHub Wiki

View/Browse Map

The module provides capabilities for viewing maps and the classic pan and zoom functions. Different map sources can be viewed as base maps overlaid by additional vector and bitmap layers.

Dependencies

The module depends on OpenLayers 3 library [1]. It enables to display map content on a web page.

API

Full API is available on GitHub at src/map/map.js.

Examples

Typical application of the module is exemplified in Listing 1. It creates a map with standard functions (pan, zoom, view layers). It is parameterised with bounding box, SRS and units. Name of HTML div element is also provided to indicate where the map should be displayed. Finally, a layer is added to the map. Of course, multiple layers can be added.

var options = {
    epsg: "EPSG:3003",
    bounds: [1618102.37, 4942652.95, 1640661.9, 4959185],
    units: 'm'
};

var gscMap = new gsc.map.Map('map',options);

var reggio_emilia = new ol.layer.Image({
    source: new ol.source.ImageWMS({
        ratio: 1,
        url: 'http://hub.geosmartcity.eu/geoserver/reggio_emilia/wms',
        params: {'FORMAT': 'image/png',
            'VERSION': '1.1.1',
            LAYERS: 'reggio_emilia:edifici',
            STYLES: ''
        }
    })
});

gscMap.addLayer(reggio_emilia);

Additional examples can be found at