-
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 a bug on determining srid when upload a vector layer #437
fix a bug on determining srid when upload a vector layer #437
Conversation
This PR is addressing what i believe as a bug at uploading a vector layer.
However, the geonode doesn't recognize this. @gubuntu The first |
Codecov Report
@@ Coverage Diff @@
## 2.8.x-qgis_server #437 +/- ##
==================================================
Coverage 41.04% 41.04%
==================================================
Files 403 403
Lines 28706 28706
Branches 3648 3648
==================================================
Hits 11782 11782
Misses 16202 16202
Partials 722 722
Continue to review full report at Codecov.
|
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.
LGTM 👍 thanks!
@@ -375,7 +377,8 @@ def get_bbox(filename): | |||
bbox_y0 = min(ext[0][1], ext[2][1]) | |||
bbox_x1 = max(ext[0][0], ext[2][0]) | |||
bbox_y1 = max(ext[0][1], ext[2][1]) | |||
srid = srs.GetAuthorityCode(None) if srs else 'EPSG:4326' | |||
# eliminate default EPSG srid as it will be added when this function returned | |||
srid = srs.GetAuthorityCode(None) if srs else '4326' | |||
|
|||
return [bbox_x0, bbox_x1, bbox_y0, bbox_y1, "EPSG:%s" % str(srid)] |
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.
even an expert geonode developer can miss 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.
This should have been tested by unittest. If not, then we should add.
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.
Also we need to submit PR to upstream GeoNode for issues like 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.
@boney-bun cc @lucernae we should be doing all GeoNode PRs directly upstream.
Also why is this merged when we decided to not assume 4326 if no projection defined?
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.
@boney-bun cc @myarjunar I think it is wrong to say if NB: Not all projections are entered in the EPSG database but the important thing is the projection string cape.zip |
@NyakudyaA I reckon what @boney-bun did here is only to fix programming error that causes the method returned |
thanks @myarjunar you've got my point. @NyakudyaA @gubuntu this is where i need an opinion from a GIS expert :) technically speaking, the original code:
so to accomodate @NyakudyaA comment, our options are:
we may need to make a PR to the upstream. which one do you prefer @NyakudyaA @gubuntu ? |
@boney-bun I think the best way you could do is do a PR against upstream with your changes.
|
Codecov Report
@@ Coverage Diff @@
## 2.8.x-qgis_server #437 +/- ##
=====================================================
+ Coverage 41.04% 41.05% +0.01%
=====================================================
Files 403 403
Lines 28706 28715 +9
Branches 3648 3648
=====================================================
+ Hits 11782 11789 +7
- Misses 16202 16204 +2
Partials 722 722
Continue to review full report at Codecov.
|
Hi @NyakudyaA I've changed the code a bit. For @NyakudyaA @gubuntu please review the code from the GIS perspective. then, i could make a pr to the upstream. |
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.
When EPSG: code is not found it should not be assumed to be 4326. Let's rather default to using the proj4 text to define the projection. See how the EPSG:Code is being used by the front end.
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.
LGTM. On a side note, does the previous code works with GeoNode dataset? Because it's hard to imagine that this passed their unittest.
@@ -375,7 +377,8 @@ def get_bbox(filename): | |||
bbox_y0 = min(ext[0][1], ext[2][1]) | |||
bbox_x1 = max(ext[0][0], ext[2][0]) | |||
bbox_y1 = max(ext[0][1], ext[2][1]) | |||
srid = srs.GetAuthorityCode(None) if srs else 'EPSG:4326' | |||
# eliminate default EPSG srid as it will be added when this function returned | |||
srid = srs.GetAuthorityCode(None) if srs else '4326' | |||
|
|||
return [bbox_x0, bbox_x1, bbox_y0, bbox_y1, "EPSG:%s" % str(srid)] |
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 should have been tested by unittest. If not, then we should add.
@@ -375,7 +377,8 @@ def get_bbox(filename): | |||
bbox_y0 = min(ext[0][1], ext[2][1]) | |||
bbox_x1 = max(ext[0][0], ext[2][0]) | |||
bbox_y1 = max(ext[0][1], ext[2][1]) | |||
srid = srs.GetAuthorityCode(None) if srs else 'EPSG:4326' | |||
# eliminate default EPSG srid as it will be added when this function returned | |||
srid = srs.GetAuthorityCode(None) if srs else '4326' | |||
|
|||
return [bbox_x0, bbox_x1, bbox_y0, bbox_y1, "EPSG:%s" % str(srid)] |
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.
Also we need to submit PR to upstream GeoNode for issues like this.
thanks for the review @NyakudyaA @myarjunar @lucernae |
fix #289
fix #435