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

Giuseppe De Marco peppelinux at yahoo.it
Tue May 15 10:51:06 EDT 2012


You're right Volker,

it was a dummy examples,
I'm playng with a local WMS and now I'm in trouble with two things:

1. The layer initialize with 0 opacity
2. when map zoom change the ol_layer doesn't update 

I'm playing with:

        jQuery('#map').data("mapQuery").layers({
            type:'existing_ol',
            label:'example',
            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:pcn_orto_06_sm_tlch,
            min_zoom:2,
            url:pcn_orto_06_sm_tlch.url,
            layers:pcn_orto_06_sm_tlch.params.LAYERS,
            });
        }); 





________________________________
 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:23
Oggetto: Re: [MapQuery] how to add an existing ol layer to mapquery
 
Hi Giuseppe,

where do you actually initialise the new layer? Is it already
initialised in ol_layer? It looks a bit strange that you use a WMS bit
have a Layer names osm.

Cheers,
  Volker

On 05/15/2012 04:07 PM, Giuseppe De Marco wrote:
> 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/c5867d90/attachment-0001.html


More information about the MapQuery mailing list