Skip to content
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

4306 Added notification for unsupported GeoServer projections. #4311

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

kjlippold
Copy link
Contributor

Pull Request Checklist:

  • Positive Test Case Written by Dev
  • Automated Testing
  • Sufficient User and Developer Documentation
  • Passing Jenkins Build
  • Peer Code review and approval

Positive Test Case

  1. [Enter positive test case here]

@hydrocheck
Copy link
Collaborator

METRIC VALUE
NEW DUPLICATED LINES DENSITY 41.5584415584416
NEW CODE SMELLS 4
NEW SECURITY HOTSPOTS 0
NEW VULNERABILITIES 0
NEW BUGS 1

https://sonarqube.cuahsi-workstation.com:9000/dashboard?id=hydroshare-4311

proj = osr.SpatialReference(wkt=str(self.originalcoverage.projection_string))
authority = ':'.join((proj.GetAttrValue('AUTHORITY', 0), proj.GetAttrValue('AUTHORITY', 1),))

with open(os.path.dirname(__file__) + '/../geoserver_epsg.txt') as f:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is the same implementation as raster. This approach also add an aggregation type specific method to the abstract metadata class that is used by all aggregation types. It can argued we already walked this path with preview_data_url, but I'd like to unwind this problem before we walk further down the path.

This implementation also reads and scans a file for every raster/feature aggregation in the resource each time the page is displayed. We should be doing this once and storing the result somewhere in the metadata so we're not reading the same file n times with each page load.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where would you recommend storing that type of metadata? I asked Alva about that when we first set up GeoServer and he said HydroShare didn't have a way to handle system metadata that isn't modifiable by users. That's why we went the route of generating the GeoServer URLs each time the page was loaded instead of doing it once and storing them somewhere.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an extra_data field on each logical file for this type of thing. @hyi - used it for storing the URL in a .url file.

https://github.com/hydroshare/hydroshare/blob/develop/hs_file_types/models/base.py#L723

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've moved the projection checks to the update_web_services task, so the check will only happen when web services are updated, and the result is stored in extra_data: 0c1176a

'If you want access to GeoServer features for those files, please make sure ' +
'they are using a supported projection. ' +
'<br><strong><a ' +
'href="' + geoserver_url + '/hydroshare/wms?request=GetCapabilities" ' +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A url path hardcoded into a javascript string of html is going to be difficult to manage updates if/when it changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved GetCapabilities URL to settings.py: 28ca8e9

Copy link
Contributor

@sblack-usu sblack-usu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy to talk about my concerns in more detail if you'd like. The biggest one is reading the file with each geofeature/raster aggregation. The other concerns are important, but there certainly is a precedent for the implementation you chose. But, I'd prefer to work out a more general solution with you.

@@ -702,6 +702,12 @@ def get_preview_data_url(self, resource, folder_path):
# - subclass needs to override this
return None

@classmethod
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is no longer used and should be deleted

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve removed this method here: 88b583f

@@ -169,6 +171,8 @@ def data_store_structure(request):
resource=resource,
folder_path=f_store_path
),
'valid_geoserver_projection':
f.logical_file.extra_data.get('valid_geoserver_proj', 'True'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this default to False?

Copy link
Contributor

@sblack-usu sblack-usu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. Just need an unused method to be deleted and I'll approve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants