-
Notifications
You must be signed in to change notification settings - Fork 17
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
Fix maps test for qgis_server #235
Conversation
Codecov Report
@@ Coverage Diff @@
## master-qgis_server #235 +/- ##
======================================================
+ Coverage 44.28% 44.81% +0.53%
======================================================
Files 254 254
Lines 18292 18318 +26
Branches 2409 2410 +1
======================================================
+ Hits 8100 8209 +109
+ Misses 9719 9633 -86
- Partials 473 476 +3
Continue to review full report at Codecov.
|
9ce2647
to
e42d3ad
Compare
@@ -82,3 +89,138 @@ def validate_django_settings(): | |||
"{package}.".format(package=qgis_server.BACKEND_PACKAGE)) | |||
|
|||
return True | |||
|
|||
|
|||
def map_thumbnail_url(instance): |
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.
Check this out @Gustry , what I did is to put this as a helper function and not a django view. Then I deleted map_thumbnail django view. Is it ok to do this?
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.
Ok, I guess it's much better as it will be integrated with Geonode resources (set thumbnail manually etc, list of resources ...)
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.
Nice !
self.bbox_x1 = box[1] | ||
self.bbox_y0 = box[2] | ||
self.bbox_y0 = box[1] | ||
self.bbox_x1 = box[2] |
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.
Was-it a bug in geonode upstream ? This makes me very worried !
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 like a very consistent inconsistency 😟 and it's been around since 2012.
The problem is as follow:
If you see bbox property from above (in the same file)
the format is: [x0,y0,x1,y1] which is probably the standard format, CMIIW.
However, set_latlon_bounds assumes the format: [x0,x1,y0,y1]
Some bbox calculation in maps creation seems wrong because it takes layer.bbox (which inherits from base), but comparing it as if [x0,x1,y0,y1] to get the largest extent of multiple layers. Then it uses this method to set the bbox. Which is swapped.
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.
I believe this has to be double/triple checked everywhere they use this property. Because this is hectic !
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.
I even tried to screen it again the third time for separate PR in upstream. For us, we only use leaflet map view, so we know where to look.
@@ -82,3 +89,138 @@ def validate_django_settings(): | |||
"{package}.".format(package=qgis_server.BACKEND_PACKAGE)) | |||
|
|||
return True | |||
|
|||
|
|||
def map_thumbnail_url(instance): |
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.
Ok, I guess it's much better as it will be integrated with Geonode resources (set thumbnail manually etc, list of resources ...)
@@ -559,6 +559,7 @@ def __unicode__(self): | |||
|
|||
@property | |||
def bbox(self): | |||
"""BBOX is in the format: [x0,y0,x1,y1].""" |
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.
add this docstring to avoid people having the same mistake.
bbox[1] = max(bbox[1], layer_bbox[1]) | ||
bbox[2] = min(bbox[2], layer_bbox[2]) | ||
bbox[1] = min(bbox[1], layer_bbox[1]) | ||
bbox[2] = max(bbox[2], layer_bbox[2]) |
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.
CC @Gustry
This is the part which gets funny because it compares layer.bbox which is in [x0,y0,x1,y1] format for the first layer bbox, but comparing it with the others as if the format is [x0,x1,y0,y1]. Then when the user saves the map, it will be saved and swapped.
6cc324c
to
52dacb1
Compare
- Refactor thumbnail url generator for QGIS Server. Now giving direct url to QGIS Server, instead of proxying to Django. - Remove unnecessary thumbnail view in qgis_server, because geonode already have internal cache for thumbnail. Thumbnail should just be accessed directly to QGIS Server without proxy. - Fix map creation test. - Refactor wrong/inconsistent bbox convention for maps.
Merge this before anymore changes :)) |
Refactor thumbnail url generator for QGIS Server. Now giving direct url to
QGIS Server, instead of proxying to Django.
Remove unnecessary thumbnail view in qgis_server, because geonode already
have internal cache for thumbnail. Thumbnail should just be accessed
directly to QGIS Server without proxy.
Fix map creation test.
Refactor wrong/inconsistent bbox convention for maps.