-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Download filtered layer #3321
Download filtered layer #3321
Conversation
…load_filtered_layer
Thanks @karakostis , some comments in line. The tests are failing, could you take a look? I could be simple pep8 violations. |
Hey @simod thanks! I think it was a pep8 issue with setup.py. Lets see if is resolved. Silly question but where did u put the inline comments? :) |
geonode/layers/views.py
Outdated
@@ -430,8 +432,117 @@ def layer_detail(request, layername, template='layers/layer_detail.html'): | |||
if settings.SOCIAL_ORIGINS: | |||
context_dict["social_links"] = build_social_links(request, layer) | |||
|
|||
|
|||
#d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@karakostis Is this part of code needed by your feature?
geonode/layers/views.py
Outdated
|
||
# loop the dictionary based on the values on the list and add the properties | ||
# in the dictionary (if doesn't exist) together with the value | ||
from six import string_types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@karakostis can you import this at the top?
setup.py
Outdated
@@ -141,7 +141,7 @@ | |||
"factory_boy", | |||
# "WeasyPrint", | |||
|
|||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is causing conflicts, can you merge with master?
oh probably was my fault, I didn't hit the submit comments... sorry |
I am not really sure what is the issue. Is there a way to see where is the conflict? |
woah this log became way too long to read. Did you run the tests locally? @afabiani most of the noise seems to be related to geoserver messaging, any way we can limit it? |
geonode/layers/views.py
Outdated
@@ -429,12 +432,119 @@ def layer_detail(request, layername, template='layers/layer_detail.html'): | |||
if settings.SOCIAL_ORIGINS: | |||
context_dict["social_links"] = build_social_links(request, layer) | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@karakostis I was talking about this whole chunk of code, is it related to your feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. This part of code is related to the feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the issue must be related with the that chunk of code. As I see in the log file something breaks there and returns the Exception message:
LL: <CDLL 'libc.so.6', handle 7fb2157ee9b0 at 7fb1f573ce90>
.on_geoserver_messages: RECEIVED MSG - body: {'rating': '0', 'constraints_other': 'None', 'bbox_x0': 'None', 'csw_mdsource': 'local', 'csw_schema': 'http://www.isotc211.org/2005/gmd', 'csw_typename': 'gmd:MD_Metadata', 'date_type': 'publication', 'srid': 'EPSG:4326', 'bbox_x1': 'None', 'edition': 'None', 'featured': 'False', 'owner': 'None', 'detail_url': 'None', 'id': 1, 'category': 'None', 'license': 'None', 'spatial_representation_type': 'None', 'uuid': u'', 'title': u'', 'alternate': 'None', 'regions': '[]', 'thumbnail_url': 'None', 'share_count': '0', 'abstract': u'', 'bbox_y0': 'None', 'bbox_y1': 'None', 'popular_count': '0', 'contacts': '[]', 'purpose': 'None', 'date': '2017-09-26 15:58:14.589434', 'group': 'None', 'temporal_extent_end': 'None', 'language': 'eng', 'data_quality_statement': 'None', 'restriction_code_type': 'None', 'maintenance_frequency': 'None', 'csw_anytext': 'None', 'metadata_xml': '<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd"/>', 'tkeywords': '[]', 'metadata_uploaded_preserve': 'False', 'csw_type': 'dataset', 'keywords': '[]', 'metadata_uploaded': 'False', 'csw_wkt_geometry': 'POLYGON((-180 -90,-180 90,180 90,180 -90,-180 -90))', 'temporal_extent_start': 'None', 'is_published': True}
Layer matching query does not exist.
Traceback (most recent call last):
File "/home/travis/build/GeoNode/geonode/geonode/geoserver/signals.py", line 94, in geoserver_post_save_local
instance = Layer.objects.get(id=layer_id)
File "/home/travis/virtualenv/python2.7_with_system_site_packages/local/lib/python2.7/site-packages/django/db/models/manager.py", line 127, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/travis/virtualenv/python2.7_with_system_site_packages/local/lib/python2.7/site-packages/django/db/models/query.py", line 334, in get
self.model._meta.object_name
DoesNotExist: Layer matching query does not exist.
on_geoserver_messages: finished
finished.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is not clear, a geoserver post_save signal cannot find the resource for which it was called. Strange.
The errors take place in the following two lines. In the first one I use gsconfig: |
geonode/layers/views.py
Outdated
|
||
try: | ||
# get type of layer (raster or vector) | ||
cat = Catalog(settings.OGC_SERVER['default']['LOCATION'] + "rest", settings.OGC_SERVER['default']['USER'], settings.OGC_SERVER['default']['PASSWORD']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@karakostis we actually should avoid to call the catalog here. Catalog operations should only be delegated to the geoserver app, layer detail should only be reading from the database.
Thanks @simod . Well noted. I will change this. But I think there must be another more general issue. I tried to run the tests locally in my master branch and I still keep getting the same errors. Can you replicate? Tests run smoothly from your side? |
@karakostis consider that right now the tests are failing on master, probably due to some recent updates in the java machinery packages. But I'll run them locally too and help out to see what we can change. |
@karakostis can you merge from master now? Let's see if the tests give better result. |
…download_filtered_layer
…download_filtered_layer
@simod I have refactored part of the code in the layers/views.py so that I don't call the Catalog. Running the tests causes same issues. When I run them locally I get errors in:
|
@karakostis @simod I pushed another build of this PR. Currently the unique issue should be related to formatting stuff flake8 geonode |
@karakostis just tested it, It works but I noticed a javascript error when clicking on "+" button. Can you maybe double check? |
@afabiani sure! |
In GeoNode it is possible to download parts of a layer using a Query Builder. The Query Builder provides a step by step graphical environment, where the user is able to select attributes existing in the layer (e.g. population of an area) and set numerical or text filters.
The filters can be chained together either by an AND or an OR operator. Moreover when building the Query statements, the user can retrieve all the available values for each attribute. This is particularly useful, when the user wants to filter data based on numbers, locations etc. which he/she is not familiarized.
As this is my first commit to GeoNode community, kindly let me know in case of corrections, best practices and recommendations. Thanks!