librelist archives

« back to archive

Add predefined WMS to geonode

Add predefined WMS to geonode

From:
Patrick Krejci
Date:
2011-09-05 @ 11:55
Hi list,
Geonode provides the feature, that you can add Servers with a
GetCapabiltiesRequest to the "Available Layers" Dialog by creation of a map.
Now I want to add a WMS (GetCapabilities-Request) directly to the "Available
Layers" dialog, so that a user can get predefined WMS Layers from the
dropdownlist, instead of adding the GetCapabilitiesRequest with the Add
Server button.

How can I get more than the GeoServer layers and the Google Layers available
in the dropdownlist or which file must be modified to change this in the
geonode structure?

Thanks & Best Regards

--
Patrick

Re: [geonode] Add predefined WMS to geonode

From:
David Winslow
Date:
2011-09-05 @ 14:10
I believe adding an appropriate entry to the MAP_BASELAYERSOURCES will get
your WMS into every map by default.

--
David Winslow
OpenGeo - http://opengeo.org/

On Mon, Sep 5, 2011 at 7:55 AM, Patrick Krejci <p.krejci@ceit.at> wrote:

> Hi list,
> Geonode provides the feature, that you can add Servers with a
> GetCapabiltiesRequest to the "Available Layers" Dialog by creation of a map.
> Now I want to add a WMS (GetCapabilities-Request) directly to the
> "Available Layers" dialog, so that a user can get predefined WMS Layers from
> the dropdownlist, instead of adding the GetCapabilitiesRequest with the Add
> Server button.
>
> How can I get more than the GeoServer layers and the Google Layers
> available in the dropdownlist or which file must be modified to change this
> in the geonode structure?
>
> Thanks & Best Regards
>
> --
> Patrick
>
>

Re: [geonode] Add predefined WMS to geonode

From:
Patrick Krejci
Date:
2011-09-05 @ 15:05
Hi David,
sorry but I don't understand it, I thought that the MAP_BASELAYERSOURCES are
to set the sources of the MAP_BASELAYERS which are visible on the LayerTree
on the left side.

I hope you understand my description above. But I want to add a Server to
the Available Layers Dialog which pops up if you create a new map oder press
the add new layer button. For that purpose the same
variable MAP_BASELAYERSOURCES is also responsible? Can you explain to me,
what the ptype property does?

MAP_BASELAYERSOURCES = {
    "any": {
        "ptype":"gx_olsource"
    },
    "capra": {
        "url":"/geoserver/wms"
    },
    "google":{
        "ptype":"gx_googlesource",
        "apiKey": GOOGLE_API_KEY
    }
}

MAP_BASELAYERS = [{
    "source":"any",
    "type":"OpenLayers.Layer",
    "args":["No background"],
    "visibility": False,
    "fixed": True,
    "group":"background"
  },{

........

*
*



--
Patrick

2011/9/5 David Winslow <dwinslow@opengeo.org>

> I believe adding an appropriate entry to the MAP_BASELAYERSOURCES will get
> your WMS into every map by default.
>
> --
> David Winslow
> OpenGeo - http://opengeo.org/
>
>
> On Mon, Sep 5, 2011 at 7:55 AM, Patrick Krejci <p.krejci@ceit.at> wrote:
>
>> Hi list,
>> Geonode provides the feature, that you can add Servers with a
>> GetCapabiltiesRequest to the "Available Layers" Dialog by creation of a map.
>> Now I want to add a WMS (GetCapabilities-Request) directly to the
>> "Available Layers" dialog, so that a user can get predefined WMS Layers from
>> the dropdownlist, instead of adding the GetCapabilitiesRequest with the Add
>> Server button.
>>
>> How can I get more than the GeoServer layers and the Google Layers
>> available in the dropdownlist or which file must be modified to change this
>> in the geonode structure?
>>
>> Thanks & Best Regards
>>
>> --
>> Patrick
>>
>>
>

Re: [geonode] Add predefined WMS to geonode

From:
Andreas Hocevar
Date:
2011-09-06 @ 08:52
Hi,

On Sep 5, 2011, at 17:05 , Patrick Krejci wrote:

> Hi David,
> sorry but I don't understand it, I thought that the MAP_BASELAYERSOURCES
are to set the sources of the MAP_BASELAYERS which are visible on the 
LayerTree on the left side.

Yes, but these sources are also used for the Available Layers dropdown in 
the Add Layers dialog.

> I hope you understand my description above. But I want to add a Server 
to the Available Layers Dialog which pops up if you create a new map oder 
press the add new layer button. For that purpose the same variable 
MAP_BASELAYERSOURCES is also responsible?

Yes indeed.

> Can you explain to me, what the ptype property does?

The ptype references a gxp plugin. See 
http://gxp.opengeo.org/master/doc/lib/plugins.html. And the default ptype 
is "gxp_wmscsource". So look at the "capra" source:

> MAP_BASELAYERSOURCES = {
>     "any": {
>         "ptype":"gx_olsource"
>     },
>     "capra": {
>         "url":"/geoserver/wms"
>     },
>     "google":{
>         "ptype":"gx_googlesource",
>         "apiKey": GOOGLE_API_KEY
>     }
> }

You can define an arbitrary WMS source the same way, e.g.

"my_wms": {
    "url": "http://my-wms/geoserver/wms"
}

Andreas.

-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.

Re: [geonode] Add predefined WMS to geonode

From:
Andreas Hocevar
Date:
2011-09-06 @ 11:38
On Sep 6, 2011, at 10:52 , Andreas Hocevar wrote:

> Hi,
> 
> On Sep 5, 2011, at 17:05 , Patrick Krejci wrote:
> 
>> Hi David,
>> sorry but I don't understand it, I thought that the 
MAP_BASELAYERSOURCES are to set the sources of the MAP_BASELAYERS which 
are visible on the LayerTree on the left side.
> 
> Yes, but these sources are also used for the Available Layers dropdown 
in the Add Layers dialog.

Actually scratch that. Only sources from MAP_BASELAYERSOURCES that are 
used by one of the layers in MAP_BASELAYERS show up in the Available 
Layers dropdown.

The only other way for adding a permanent layer source right now is to 
modify geonode/maps/models.py and add it in the uniquify method (see 
https://github.com/GeoNode/geonode/blob/master/src/GeoNodePy/geonode/maps/models.py#L1281).

Andreas. 

> 
>> I hope you understand my description above. But I want to add a Server 
to the Available Layers Dialog which pops up if you create a new map oder 
press the add new layer button. For that purpose the same variable 
MAP_BASELAYERSOURCES is also responsible?
> 
> Yes indeed.
> 
>> Can you explain to me, what the ptype property does?
> 
> The ptype references a gxp plugin. See 
http://gxp.opengeo.org/master/doc/lib/plugins.html. And the default ptype 
is "gxp_wmscsource". So look at the "capra" source:
> 
>> MAP_BASELAYERSOURCES = {
>>    "any": {
>>        "ptype":"gx_olsource"
>>    },
>>    "capra": {
>>        "url":"/geoserver/wms"
>>    },
>>    "google":{
>>        "ptype":"gx_googlesource",
>>        "apiKey": GOOGLE_API_KEY
>>    }
>> }
> 
> You can define an arbitrary WMS source the same way, e.g.
> 
> "my_wms": {
>    "url": "http://my-wms/geoserver/wms"
> }
> 
> Andreas.
> 
> -- 
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
> 

-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.

Re: [geonode] Add predefined WMS to geonode

From:
Spanring, Christian
Date:
2011-09-06 @ 13:25
FWIW, I added similar functionality to my fork of GeoNode last year by 
tweaking the map viewer configuration produced by the viewer_json method 
of the Maps class and adding a new setting called 'DEFAULT_MAP_WMS':


https://github.com/cspanring/geonode/commit/096da0b67430e67a1e022bcb30888149ecb0aca6

I scratched it later again because its performance wasn't ideal and I 
think similar functionality is on GeoNode's roadmap anyways, if I  
remember correctly.

Christian

-----Original Message-----
From: geonode@librelist.com [mailto:geonode@librelist.com] On Behalf Of 
Andreas Hocevar
Sent: Tuesday, September 06, 2011 7:39 AM
To: geonode@librelist.com
Subject: Re: [geonode] Add predefined WMS to geonode

On Sep 6, 2011, at 10:52 , Andreas Hocevar wrote:

> Hi,
>
> On Sep 5, 2011, at 17:05 , Patrick Krejci wrote:
>
>> Hi David,
>> sorry but I don't understand it, I thought that the 
MAP_BASELAYERSOURCES are to set the sources of the MAP_BASELAYERS which 
are visible on the LayerTree on the left side.
>
> Yes, but these sources are also used for the Available Layers dropdown 
in the Add Layers dialog.

Actually scratch that. Only sources from MAP_BASELAYERSOURCES that are 
used by one of the layers in MAP_BASELAYERS show up in the Available 
Layers dropdown.

The only other way for adding a permanent layer source right now is to 
modify geonode/maps/models.py and add it in the uniquify method (see 
https://github.com/GeoNode/geonode/blob/master/src/GeoNodePy/geonode/maps/models.py#L1281).

Andreas.

>
>> I hope you understand my description above. But I want to add a Server 
to the Available Layers Dialog which pops up if you create a new map oder 
press the add new layer button. For that purpose the same variable 
MAP_BASELAYERSOURCES is also responsible?
>
> Yes indeed.
>
>> Can you explain to me, what the ptype property does?
>
> The ptype references a gxp plugin. See 
http://gxp.opengeo.org/master/doc/lib/plugins.html. And the default ptype 
is "gxp_wmscsource". So look at the "capra" source:
>
>> MAP_BASELAYERSOURCES = {
>>    "any": {
>>        "ptype":"gx_olsource"
>>    },
>>    "capra": {
>>        "url":"/geoserver/wms"
>>    },
>>    "google":{
>>        "ptype":"gx_googlesource",
>>        "apiKey": GOOGLE_API_KEY
>>    }
>> }
>
> You can define an arbitrary WMS source the same way, e.g.
>
> "my_wms": {
>    "url": "http://my-wms/geoserver/wms"
> }
>
> Andreas.
>
> --
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
>

--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


Please be advised that the Massachusetts Secretary of State considers 
e-mail to be a public record, and therefore subject to the Massachusetts 
Public Records Law, M.G.L. c. 66 § 10.

Re: [geonode] Add predefined WMS to geonode

From:
David Winslow
Date:
2011-09-06 @ 13:44
This is interesting.  If you remember any more detail about the performance
issues, I'd appreciate a mail to the dev list about it (we have gotten a few
complaints recently about the volume of mail to this one.)  I think the
direction we'd been planning to take things with WMS services in GeoNode was
toward storing information about them in the database, which would probably
not be faster than reading a Python dict from settings.

--
David Winslow
OpenGeo - http://opengeo.org/

On Tue, Sep 6, 2011 at 9:25 AM, Spanring, Christian <CSpanring@mapc.org>wrote:

> FWIW, I added similar functionality to my fork of GeoNode last year by
> tweaking the map viewer configuration produced by the viewer_json method of
> the Maps class and adding a new setting called 'DEFAULT_MAP_WMS':
>
>
> 
https://github.com/cspanring/geonode/commit/096da0b67430e67a1e022bcb30888149ecb0aca6
>
> I scratched it later again because its performance wasn't ideal and I think
> similar functionality is on GeoNode's roadmap anyways, if I  remember
> correctly.
>
> Christian
>
> -----Original Message-----
> From: geonode@librelist.com [mailto:geonode@librelist.com] On Behalf Of
> Andreas Hocevar
> Sent: Tuesday, September 06, 2011 7:39 AM
> To: geonode@librelist.com
> Subject: Re: [geonode] Add predefined WMS to geonode
>
> On Sep 6, 2011, at 10:52 , Andreas Hocevar wrote:
>
> > Hi,
> >
> > On Sep 5, 2011, at 17:05 , Patrick Krejci wrote:
> >
> >> Hi David,
> >> sorry but I don't understand it, I thought that the MAP_BASELAYERSOURCES
> are to set the sources of the MAP_BASELAYERS which are visible on the
> LayerTree on the left side.
> >
> > Yes, but these sources are also used for the Available Layers dropdown in
> the Add Layers dialog.
>
> Actually scratch that. Only sources from MAP_BASELAYERSOURCES that are used
> by one of the layers in MAP_BASELAYERS show up in the Available Layers
> dropdown.
>
> The only other way for adding a permanent layer source right now is to
> modify geonode/maps/models.py and add it in the uniquify method (see
> 
https://github.com/GeoNode/geonode/blob/master/src/GeoNodePy/geonode/maps/models.py#L1281
> ).
>
> Andreas.
>
> >
> >> I hope you understand my description above. But I want to add a Server
> to the Available Layers Dialog which pops up if you create a new map oder
> press the add new layer button. For that purpose the same variable
> MAP_BASELAYERSOURCES is also responsible?
> >
> > Yes indeed.
> >
> >> Can you explain to me, what the ptype property does?
> >
> > The ptype references a gxp plugin. See
> http://gxp.opengeo.org/master/doc/lib/plugins.html. And the default ptype
> is "gxp_wmscsource". So look at the "capra" source:
> >
> >> MAP_BASELAYERSOURCES = {
> >>    "any": {
> >>        "ptype":"gx_olsource"
> >>    },
> >>    "capra": {
> >>        "url":"/geoserver/wms"
> >>    },
> >>    "google":{
> >>        "ptype":"gx_googlesource",
> >>        "apiKey": GOOGLE_API_KEY
> >>    }
> >> }
> >
> > You can define an arbitrary WMS source the same way, e.g.
> >
> > "my_wms": {
> >    "url": "http://my-wms/geoserver/wms"
> > }
> >
> > Andreas.
> >
> > --
> > Andreas Hocevar
> > OpenGeo - http://opengeo.org/
> > Expert service straight from the developers.
> >
>
> --
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
>
>
> Please be advised that the Massachusetts Secretary of State considers
> e-mail to be a public record, and therefore subject to the Massachusetts
> Public Records Law, M.G.L. c. 66 § 10.
>