[MapQuery] how to add an existing ol layer to mapquery

Volker Mische volker.mische at gmail.com
Tue May 15 10:03:09 EDT 2012


On 05/15/2012 03:41 PM, Giuseppe De Marco wrote:
> I'm tryng to add an existing OL layer inside mapquery, without create it
> with $.MapQuery.Layer.
> 
> Is it possibile without modify sources in  jquery.mapquery.core.js ?

Hi Giuseppe,

the best way would be to add a new layer type. You would do something
like (just somewhere within your app):

$.extend($.MapQuery.Layer.types, {
    yournewlayertype: function(options) {
        // do some fancy stuff here
        return {
            layer: new OpenLayers.Layer.YourLayerType(),
            options: options
        };
    }
});

Then you can add a new layer to your MapQuery map with:
mq.layers({type: 'yournewlayertupe'});

It's just like the layer definitions for the layers that are already
defined in the ore. I hope you get the idea.

Cheers,
  Volker


More information about the MapQuery mailing list