[MapQuery] how to add an existing ol layer to mapquery
Giuseppe De Marco
peppelinux at yahoo.it
Tue May 15 10:07:11 EDT 2012
added in mapquery.core.js, at line 876:
<js code>
/*
example of initialization of an existing ol layer with mapquery:
jQuery('#map').data("mapQuery").layers({
type:'existing_ol',
label:'Label that you prefer',
legend:{url:'http://mapserver.edugis.nl/cgi-bin/mapserv?map=maps/edugis/cache/population.map&version=1.1.1&service=WMS&request=GetLegendGraphic&layer=Bevolkingsdichtheid_2010&format=image/png'},
ol_layer:osm, // its an new OpenLayer.Layer object name
});
*/
existing_ol: function(options) {
var o = $.extend(true, {}, $.fn.mapQuery.defaults.layer.all,
$.fn.mapQuery.defaults.layer.raster,
options);
var params = {
layers: options.ol_layer,
transparent: o.transparent,
format: o.format
};
if(typeof o.wms_parameters != "undefined"){
params = $.extend(params, o.wms_parameters);
}
return {
layer: options.ol_layer,
options: o
};
},
</js code>
it simply works,
any suggestion?
Thank you all
g
________________________________
Da: Volker Mische <volker.mische at gmail.com>
A: Giuseppe De Marco <peppelinux at yahoo.it>
Cc: "mapquery at lists.osgeo.org" <mapquery at lists.osgeo.org>
Inviato: Martedì 15 Maggio 2012 16:03
Oggetto: Re: [MapQuery] how to add an existing ol layer to mapquery
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapquery/attachments/20120515/df2c7b67/attachment.html
More information about the MapQuery
mailing list