<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><span>added in mapquery.core.js, at line 876:</span></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><span><br></span></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><span><js code></span></div><div><span><div>/*</div><div>example of initialization of an existing ol layer with mapquery:</div><div><br></div><div> jQuery('#map').data("mapQuery").layers({</div><div> type:'existing_ol',</div><div> label:'Label that you prefer',</div><div>
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'},</div><div> ol_layer:osm, // its an new OpenLayer.Layer object name</div><div> });</div><div><br></div><div> */</div><div> existing_ol: function(options) {</div><div> var o = $.extend(true, {}, $.fn.mapQuery.defaults.layer.all,</div><div> $.fn.mapQuery.defaults.layer.raster,</div><div> options);</div><div> var params = {</div><div> layers:
options.ol_layer,</div><div> transparent: o.transparent,</div><div> format: o.format</div><div> };</div><div> if(typeof o.wms_parameters != "undefined"){</div><div> params = $.extend(params, o.wms_parameters);</div><div> }</div><div> return {</div><div> layer: options.ol_layer,</div><div> options: o</div><div> };</div><div> }, </div></span></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size:
12pt; "><br></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "></js code></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><br></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">it simply works,</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">any suggestion?</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><br></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">Thank you all</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">g</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><br></div> <div style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif; "> <div style="font-size:
12pt; font-family: 'times new roman', 'new york', times, serif; "> <div dir="ltr"> <font size="2" face="Arial"> <hr size="1"> <b><span style="font-weight:bold;">Da:</span></b> Volker Mische <volker.mische@gmail.com><br> <b><span style="font-weight: bold;">A:</span></b> Giuseppe De Marco <peppelinux@yahoo.it> <br><b><span style="font-weight: bold;">Cc:</span></b> "mapquery@lists.osgeo.org" <mapquery@lists.osgeo.org> <br> <b><span style="font-weight: bold;">Inviato:</span></b> Marted́ 15 Maggio 2012 16:03<br> <b><span style="font-weight: bold;">Oggetto:</span></b> Re: [MapQuery] how to add an existing ol layer to mapquery<br> </font> </div> <br>On 05/15/2012 03:41 PM, Giuseppe De Marco wrote:<br>> I'm tryng to add an existing OL layer inside mapquery, without create it<br>> with $.MapQuery.Layer.<br>> <br>> Is it possibile without modify sources in jquery.mapquery.core.js ?<br><br>Hi Giuseppe,<br><br>the best way
would be to add a new layer type. You would do something<br>like (just somewhere within your app):<br><br>$.extend($.MapQuery.Layer.types, {<br> yournewlayertype: function(options) {<br> // do some fancy stuff here<br> return {<br> layer: new OpenLayers.Layer.YourLayerType(),<br> options: options<br> };<br> }<br>});<br><br>Then you can add a new layer to your MapQuery map with:<br>mq.layers({type: 'yournewlayertupe'});<br><br>It's just like the layer definitions for the layers that are already<br>defined in the ore. I hope you get the idea.<br><br>Cheers,<br> Volker<br><br><br> </div> </div> </div></body></html>