Skip to content
Christian Mayer edited this page Jan 21, 2014 · 4 revisions

Support multiple mapping libraries

Idea: Support a set of mapping libraries (e.g. OpenLayers3 , Leaflet, ...) to become more flexible in building your webmapping application.

Architecture

Introduce an adapter / bridge / interface with which GeoExt interacts and which abstracts the concrete implementation of the interaction with the library objects.

Proof-Of-Concept

While FOSSGIS Hacking Event in November 2013 a first step towards support of multiple map libraries in GeoExt has been made. An appropriate map-lib-adapter as Ext-Mixin was defined to support the creation of a simple map holding a WMS by using OpenLayers 2 or Leaflet. The code is available in the branch https://github.com/geoext/geoext2/tree/multiple-map-libs.

Especially the package 'adapter' (https://github.com/geoext/geoext2/tree/multiple-map-libs/src/GeoExt/adapter) is worth having a look if you are interested. The defined map-adapter Mixin is also shown below

Ext.define('GeoExt.adapter.MapLib', {
    extend: 'Ext.Base',
    requires: [
        'GeoExt.Version'
    ],

    config: {
        centreOfTheMap: null,

        extentOfTheMap: null,

        layersOfTheMap: null,

        mapObject: null,

        zoomOfTheMap: null

    },

    /**
     *
     */
    applyCentreOfTheMap: function(position) {
        throw new Error('applyCentreOfTheMap must be implemented');
    },

    /**
     *
     */
    applyExtentOfTheMap: function() {
        throw new Error('applyExtentOfTheMap must be implemented');
    },

    /**
     *
     */
    applyLayersOfTheMap: function() {
        throw new Error('applyLayersOfTheMap must be implemented');
    },

    /**
     *
     */
    applyMapObject: function() {
        throw new Error('applyMapObject must be implemented');
    },

    /**
     *
     */
    applyZoomOfTheMap: function() {
        throw new Error('applyZoomOfTheMap must be implemented');
    },

    /**
     *
     */
    createMap: function() {
        throw new Error('createMap must be implemented');
    },

    /**
     *
     */
    createLayers: function() {
        throw new Error('createLayers must be implemented');
    },

    /**
     *
     */
    renderMap: function(mapDivId) {
        throw new Error('renderMap must be implemented');
    },

    /**
     *
     */
    recenterMap: function(position) {
        throw new Error('recenterMap must be implemented');
    }

});

How to proceed?

A first request for the need of multiple mapping lib support by GeoExt has been posted on the GeoExt userlist: http://www.geoext.org/pipermail/users/2014-January/003375.html