[GeoNode-devel] RV: [GeoNode-users] Advanced Styling

Simone Dalmasso simone.dalmasso at gmail.com
Tue Sep 6 06:01:00 PDT 2016


Hi,

what you are doing there is not correct and it would be out of the scope of
this list to describe how django works but what I suggest you is to do the
django tutorial available here in the django docs
https://docs.djangoproject.com/en/1.10/ it will help you a lot.

regards

2016-09-06 10:06 GMT+02:00 David Alda Fernandez de Lezea <dalda at hazi.eus>:

> Hi,
>
> I'm resending this email to the developers list as I think it might be
> more suitable.  I need to have a script in GeoNode to make a query to the
> PostGIS DB to get some values so I've began the functionality under the
> geonode directory structure and following the DJANGO documentation. So far
> I've made something like this:
>
> -geonode
>
> ├── hazi
> │   ├── __init__.py
> │   ├── models.py
> │   ├── urls.py
> │   └── views.py
>
> This is the views.py content
>
>         from django.shortcuts import render_to_response
>         from django.http import HttpResponse
>         from models import DBAtribDistinctValues
>
>         def distinctValues(request):
>                 db = PostGisdb.connect(user=DATABASE_USER,
> db=DATABASE_NAME, passwd=DATABASE_PASSWORD, host=DATABASE_HOST)
>                  cursor = db.cursor()
>                  cursor.execute('SELECT distinct() FROM books ORDER BY
> name')
>                  names = [row[0] for row in cursor.fetchall()]
>                  db.close()
>                  return render_to_response('book_list.html', {'names':
> names})
>
>         def hello():
>                 return HttpResponse( "<html><body>Hello</body></html>")
>
> This is the urls.py content
>
>         from django.conf.urls import url, patterns
>         from geonode.hazi import views
>
>         urlpatterns = patterns('geonode.hazi.views',
>                   url(r'^distinctValues', 'distinctValues',
> name='distinctValues'),
>                 url(r'^hello', 'hello',name='hello'),
>         )
>
> And finally de models.py
>
>         from django.contrib.gis.db import models
>
>         class DBAtribDistinctValues(models.Model):
>                 distinctValues = models.CharField(max_length=150000,
> blank=True, null=True)
>
> I've also added to the settings.py the module to the GEONODE_APPS array.
>
> So far don't get any response of neither functions. I can't even get the
> "hello" when I visit \\myip\hazi\hello
>
> I know this is a newbie question but I've no idea about Django
> programming. I've looking into google but without success.
>
> What I'm doing wrong? Any ideas?
>
> Thanks in advance.
>
> Regards.
>
> Agur bero bat,
>
>
> David Alda Fernández de Lezea
> Área de Sistemas de Información Geográfica, Planificación Territorial y
> Forestal Informazio Geografikoen Sistemak, Lurralde eta Baso Antolaketaren
> Arloa.
> dalda at hazi.eus | www.hazi.eus
> T 945 003 240 – M 627 923 170 – F 945 003 290
> Hazi | Granja Modelo de Arkaute s/n | 01192 Arkaute – Araba
>
> *********************  LEGE OHARRA   *******************   AVISOLEGAL
> *******************   DISCLAIMER   *****************************
> Mezu hau pertsonala eta isilpekoa da eta baimenik gabeko erabilera
> debekatua dago legalki. Jasotzailea ez bazara ezabatu mezua, bidali eta
> kontserbatu gabe.
> Este mensaje es personal y confidencial y su uso no autorizado está
> prohibido legalmente. Si usted no es el destinatario, proceda a borrarlo,
> sin reenviarlo ni conservarlo.
> This message is personal and confidential, unauthorised use is legally
> prohibited. If you are not the intended recipient, delete it without
> resending or backing it.
>
> -----Mensaje original-----
> De: geonode-users [mailto:geonode-users-bounces at lists.osgeo.org] En
> nombre de David Alda Fernandez de Lezea
> Enviado el: viernes, 02 de septiembre de 2016 14:44
> Para: Paolo Corti
> CC: geonode-users at lists.osgeo.org
> Asunto: Re: [GeoNode-users] Advanced Styling
>
> Hi again,
>
> I'm taking up this task again and so far I've managed to identify, from
> the geoexplorer, the layer a its datastore with db information, but now I'd
> like to make a query to the table stored in the POSTGIS db but I've got no
> clue how or  where do I have to start coding because I'm a completely
> newbie in Django. My idea is pretty simple, I'd like to add callable
> function in which I query the db and return the information to the
> geoexplorer.
>
> Can anyone point me to the right files to edit?
>
> Thanks in advance.
>
> Regards,
>
> Agur bero bat,
>
>
> David Alda Fernández de Lezea
> Área de Sistemas de Información Geográfica, Planificación Territorial y
> Forestal Informazio Geografikoen Sistemak, Lurralde eta Baso Antolaketaren
> Arloa.
> dalda at hazi.eus | www.hazi.eus
> T 945 003 240 – M 627 923 170 – F 945 003 290 Hazi | Granja Modelo de
> Arkaute s/n | 01192 Arkaute – Araba
>
> *********************  LEGE OHARRA   *******************   AVISOLEGAL
> *******************   DISCLAIMER   ***************************** Mezu hau
> pertsonala eta isilpekoa da eta baimenik gabeko erabilera debekatua dago
> legalki. Jasotzailea ez bazara ezabatu mezua, bidali eta kontserbatu gabe.
> Este mensaje es personal y confidencial y su uso no autorizado está
> prohibido legalmente. Si usted no es el destinatario, proceda a borrarlo,
> sin reenviarlo ni conservarlo.
> This message is personal and confidential, unauthorised use is legally
> prohibited. If you are not the intended recipient, delete it without
> resending or backing it.
>
>
> -----Mensaje original-----
> De: Paolo Corti [mailto:pcorti at gmail.com] Enviado el: martes, 19 de julio
> de 2016 15:14
> Para: David Alda Fernandez de Lezea
> CC: geonode-users at lists.osgeo.org
> Asunto: Re: [GeoNode-users] Advanced Styling
>
> Hi David
> surely you can do that!
> GeoExplorer makes just OGC and GeoServer REST API calls, but you can add a
> GeoNode API to the mix The GeoExplorer version forked for GeoNode already
> makes some calls to GeoNode, to check permissions for a layer for example.
> You can use same approach.
> have a nice day
> p
>
> On Tue, Jul 19, 2016 at 5:23 AM, David Alda Fernandez de Lezea
> <dalda at hazi.eus> wrote:
> > Hi Paolo,
> >
> > Thanks for your response. Yes it's something that could be really
> interesting. From my point of view, unless I'm wrong, this functionality
> could be available/usable for all the layers stored in the "geonode"
> database, as they are the only layers that can be styled (WMS cascaded
> layers, which are foreign, layers can't), it would be possible to make
> query to the DB via python function, for example?
> >
> > Thanks.
> >
> > Regards.
> >
> > Agur bero bat,
> >
> >
> > David Alda Fernández de Lezea
> > Área de Sistemas de Información Geográfica, Planificación Territorial y
> Forestal Informazio Geografikoen Sistemak, Lurralde eta Baso Antolaketaren
> Arloa.
> > dalda at hazi.eus | www.hazi.eus
> > T 945 003 240 – M 627 923 170 – F 945 003 290 Hazi | Granja Modelo de
> > Arkaute s/n | 01192 Arkaute – Araba
> >
> > *********************  LEGE OHARRA   *******************   AVISOLEGAL
>  *******************   DISCLAIMER   *****************************
> > Mezu hau pertsonala eta isilpekoa da eta baimenik gabeko erabilera
> debekatua dago legalki. Jasotzailea ez bazara ezabatu mezua, bidali eta
> kontserbatu gabe.
> > Este mensaje es personal y confidencial y su uso no autorizado está
> prohibido legalmente. Si usted no es el destinatario, proceda a borrarlo,
> sin reenviarlo ni conservarlo.
> > This message is personal and confidential, unauthorised use is legally
> prohibited. If you are not the intended recipient, delete it without
> resending or backing it.
> >
> >
> > -----Mensaje original-----
> > De: Paolo Corti [mailto:pcorti at gmail.com] Enviado el: lunes, 18 de
> > julio de 2016 16:20
> > Para: David Alda Fernandez de Lezea
> > CC: geonode-users at lists.osgeo.org
> > Asunto: Re: [GeoNode-users] Advanced Styling
> >
> > It would be an interesting feature but I don't think there is any
> > other way than reading all the field values with a WFS request and
> > then compose the distinct values list on the client. Therefore it can
> > be overwhelming for large datasets p
> >
> > On Mon, Jul 18, 2016 at 7:55 AM, David Alda Fernandez de Lezea
> <dalda at hazi.eus> wrote:
> >> Hi list,
> >>
> >> I'm looking for some custom functionalities on GeoNode and I'm thinking
> of allowing the "gxp_styler" to read the distinct values that has the
> selected attribute field that the user specifies to classify. I don't know
> if anyone else has tried or even completed this task.
> >>
> >> In case not, I think it would be a good idea to include this in
> following versions of GeoNode.
> >>
> >> Thanks in advance.
> >>
> >> Regards,
> >>
> >> Agur bero bat,
> >>
> >>
> >> David Alda Fernández de Lezea
> >> Área de Sistemas de Información Geográfica, Planificación Territorial y
> Forestal Informazio Geografikoen Sistemak, Lurralde eta Baso Antolaketaren
> Arloa.
> >> dalda at hazi.eus | www.hazi.eus
> >> T 945 003 240 - M 627 923 170 - F 945 003 290 Hazi | Granja Modelo de
> >> Arkaute s/n | 01192 Arkaute - Araba
> >>
> >> *********************  LEGE OHARRA   *******************   AVISOLEGAL
>  *******************   DISCLAIMER   *****************************
> >> Mezu hau pertsonala eta isilpekoa da eta baimenik gabeko erabilera
> debekatua dago legalki. Jasotzailea ez bazara ezabatu mezua, bidali eta
> kontserbatu gabe.
> >> Este mensaje es personal y confidencial y su uso no autorizado está
> prohibido legalmente. Si usted no es el destinatario, proceda a borrarlo,
> sin reenviarlo ni conservarlo.
> >> This message is personal and confidential, unauthorised use is legally
> prohibited. If you are not the intended recipient, delete it without
> resending or backing it.
> >>
> >> _______________________________________________
> >> geonode-users mailing list
> >> geonode-users at lists.osgeo.org
> >> http://lists.osgeo.org/mailman/listinfo/geonode-users
> >
> >
> >
> > --
> > Paolo Corti
> > Geospatial software developer
> > web: http://www.paolocorti.net
> > twitter: @capooti
> > skype: capooti
>
>
>
> --
> Paolo Corti
> Geospatial software developer
> web: http://www.paolocorti.net
> twitter: @capooti
> skype: capooti
> _______________________________________________
> geonode-users mailing list
> geonode-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geonode-users
> _______________________________________________
> geonode-devel mailing list
> geonode-devel at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geonode-devel
>



-- 
Simone
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-devel/attachments/20160906/09aedf3f/attachment.html>


More information about the geonode-devel mailing list